diff --git a/client/txgen/main.go b/client/txgen/main.go index 1276ef348..7ee389ba8 100644 --- a/client/txgen/main.go +++ b/client/txgen/main.go @@ -286,7 +286,7 @@ func main() { // Nodes containing utxopools to mirror the shards' data in the network nodes := []*node.Node{} - for shardID, _ := range shardIDLeaderMap { + for shardID := range shardIDLeaderMap { node := node.New(&consensus.Consensus{ShardID: shardID}, nil) // Assign many fake addresses so we have enough address to play with at first node.AddTestingAddresses(setting.numOfAddress) diff --git a/identitychain/identitychain.go b/identitychain/identitychain.go index 39550860e..f0f88871f 100644 --- a/identitychain/identitychain.go +++ b/identitychain/identitychain.go @@ -61,7 +61,6 @@ func (IDC *IdentityChain) Shard() { //ElectLeaders func (IDC *IdentityChain) ElectLeaders() { - return } //BroadCastNewConfiguration diff --git a/node/node_handler.go b/node/node_handler.go index c253b1119..91dc51c37 100644 --- a/node/node_handler.go +++ b/node/node_handler.go @@ -30,7 +30,7 @@ const ( // MaybeBroadcastAsValidator returns if the node is a validator node. func (node *Node) MaybeBroadcastAsValidator(content []byte) { - if node.SelfPeer.ValidatorID > 0 && node.SelfPeer.ValidatorID <= p2p.MAX_BROADCAST { + if node.SelfPeer.ValidatorID > 0 && node.SelfPeer.ValidatorID <= p2p.MaxBroadCast { go p2p.BroadcastMessageFromValidator(node.SelfPeer, node.Consensus.GetValidatorPeers(), content) } } diff --git a/p2p/peer.go b/p2p/peer.go index 88c42386e..59eb0664f 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -24,7 +24,7 @@ type Peer struct { // TODO(minhdoan, rj): use this Ready to not send/broadcast to this peer if it wasn't available. } -const MAX_BROADCAST = 20 +const MaxBroadCast = 20 // SendMessage sends the message to the peer func SendMessage(peer Peer, msg []byte) { @@ -64,14 +64,14 @@ func SelectMyPeers(peers []Peer, min int, max int) []Peer { // BroadcastMessage sends the message to a list of peers from a leader. func BroadcastMessageFromLeader(peers []Peer, msg []byte) { // TODO(minhdoan): Enable back for multicast. - peers = SelectMyPeers(peers, 1, MAX_BROADCAST) + peers = SelectMyPeers(peers, 1, MaxBroadCast) BroadcastMessage(peers, msg) log.Info("Done sending from leader") } // BroadcastMessage sends the message to a list of peers from a validator. func BroadcastMessageFromValidator(selfPeer Peer, peers []Peer, msg []byte) { - peers = SelectMyPeers(peers, selfPeer.ValidatorID*MAX_BROADCAST+1, (selfPeer.ValidatorID+1)*MAX_BROADCAST) + peers = SelectMyPeers(peers, selfPeer.ValidatorID*MaxBroadCast+1, (selfPeer.ValidatorID+1)*MaxBroadCast) BroadcastMessage(peers, msg) log.Info("Done sending from validator") }