fix dependencies

pull/113/head
Minh Doan 6 years ago
parent 7b37717e7e
commit 15fddd608f
  1. 3
      consensus/bft.go
  2. 8
      consensus/consensus.go
  3. 6
      consensus/consensus_validator.go

@ -9,9 +9,11 @@ import (
"github.com/harmony-one/harmony/core/types"
)
// Bft is the struct for Bft protocol.
type Bft struct {
}
// NewFaker returns Bft.
func NewFaker() *Bft {
return &Bft{}
}
@ -106,6 +108,7 @@ func (bft *Bft) SealHash(header *types.Header) (hash common.Hash) {
return hash
}
// Seal ...
func (bft *Bft) Seal(chain ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
return nil
}

@ -121,7 +121,7 @@ func NewConsensus(ip, port, ShardID string, peers []p2p.Peer, leader p2p.Peer) *
consensus.leader = leader
for _, peer := range peers {
consensus.validators.Store(utils.GetUniqueIdFromPeer(peer), peer)
consensus.validators.Store(utils.GetUniqueIDFromPeer(peer), peer)
}
// Initialize cosign bitmap
@ -146,7 +146,7 @@ func NewConsensus(ip, port, ShardID string, peers []p2p.Peer, leader p2p.Peer) *
// For now use socket address as 16 byte Id
// TODO: populate with correct Id
consensus.nodeID = utils.GetUniqueIdFromPeer(p2p.Peer{IP: ip, Port: port})
consensus.nodeID = utils.GetUniqueIDFromPeer(p2p.Peer{IP: ip, Port: port})
// Set private key for myself so that I can sign messages.
consensus.priKey = crypto.Ed25519Curve.Scalar().SetInt64(int64(consensus.nodeID))
@ -239,12 +239,12 @@ func (consensus *Consensus) AddPeers(peers []p2p.Peer) int {
count := 0
for _, peer := range peers {
_, ok := consensus.validators.Load(utils.GetUniqueIdFromPeer(peer))
_, ok := consensus.validators.Load(utils.GetUniqueIDFromPeer(peer))
if !ok {
if peer.ValidatorID == -1 {
peer.ValidatorID = int(consensus.uniqueIDInstance.GetUniqueID())
}
consensus.validators.Store(utils.GetUniqueIdFromPeer(peer), peer)
consensus.validators.Store(utils.GetUniqueIDFromPeer(peer), peer)
consensus.PublicKeys = append(consensus.PublicKeys, peer.PubKey)
}
count++

@ -72,7 +72,7 @@ func (consensus *Consensus) processAnnounceMessage(payload []byte) {
// Verify block data
// check leader Id
myLeaderID := utils.GetUniqueIdFromPeer(consensus.leader)
myLeaderID := utils.GetUniqueIDFromPeer(consensus.leader)
if leaderID != myLeaderID {
consensus.Log.Warn("Received message from wrong leader", "myLeaderID", myLeaderID, "receivedLeaderId", leaderID, "consensus", consensus)
return
@ -175,7 +175,7 @@ func (consensus *Consensus) processChallengeMessage(payload []byte, targetState
// Verify block data and the aggregated signatures
// check leader Id
myLeaderID := utils.GetUniqueIdFromPeer(consensus.leader)
myLeaderID := utils.GetUniqueIDFromPeer(consensus.leader)
if leaderID != myLeaderID {
consensus.Log.Warn("Received message from wrong leader", "myLeaderID", myLeaderID, "receivedLeaderId", leaderID, "consensus", consensus)
return
@ -325,7 +325,7 @@ func (consensus *Consensus) processCollectiveSigMessage(payload []byte) {
// Verify block data
// check leader Id
myLeaderID := utils.GetUniqueIdFromPeer(consensus.leader)
myLeaderID := utils.GetUniqueIDFromPeer(consensus.leader)
if leaderID != myLeaderID {
consensus.Log.Warn("Received message from wrong leader", "myLeaderID", myLeaderID, "receivedLeaderId", leaderID, "consensus", consensus)
return

Loading…
Cancel
Save