Display pingpong message's effect

pull/797/head
Rongjian Lan 6 years ago committed by Leo Chen
parent f808c4d484
commit 9cebe85490
  1. 10
      node/node.go
  2. 27
      node/node_handler.go

@ -374,11 +374,11 @@ func (node *Node) AddPeers(peers []*p2p.Peer) int {
// Only leader needs to add the peer info into consensus // Only leader needs to add the peer info into consensus
// Validators will receive the updated peer info from Leader via pong message // Validators will receive the updated peer info from Leader via pong message
// TODO: remove this after fully migrating to beacon chain-based committee membership // TODO: remove this after fully migrating to beacon chain-based committee membership
if count > 0 && node.NodeConfig.IsLeader() { //if count > 0 && node.NodeConfig.IsLeader() {
node.Consensus.AddPeers(peers) // node.Consensus.AddPeers(peers)
// TODO: make peers into a context object shared by consensus and drand // // TODO: make peers into a context object shared by consensus and drand
node.DRand.AddPeers(peers) // node.DRand.AddPeers(peers)
} //}
return count return count
} }

@ -501,18 +501,18 @@ func (node *Node) pongMessageHandler(msgPayload []byte) int {
// otherwise, we may not be able to validate the consensus messages received // otherwise, we may not be able to validate the consensus messages received
// which will result in first consensus timeout // which will result in first consensus timeout
// TODO: remove this after fully migrating to beacon chain-based committee membership // TODO: remove this after fully migrating to beacon chain-based committee membership
err = node.Consensus.SetLeaderPubKey(pong.LeaderPubKey) //err = node.Consensus.SetLeaderPubKey(pong.LeaderPubKey)
if err != nil { //if err != nil {
utils.GetLogInstance().Error("Unmarshal Consensus Leader PubKey Failed", "error", err) // utils.GetLogInstance().Error("Unmarshal Consensus Leader PubKey Failed", "error", err)
} else { //} else {
utils.GetLogInstance().Info("Set Consensus Leader PubKey", "key", node.Consensus.GetLeaderPubKey()) // utils.GetLogInstance().Info("Set Consensus Leader PubKey", "key", node.Consensus.GetLeaderPubKey())
} //}
err = node.DRand.SetLeaderPubKey(pong.LeaderPubKey) //err = node.DRand.SetLeaderPubKey(pong.LeaderPubKey)
if err != nil { //if err != nil {
utils.GetLogInstance().Error("Unmarshal DRand Leader PubKey Failed", "error", err) // utils.GetLogInstance().Error("Unmarshal DRand Leader PubKey Failed", "error", err)
} else { //} else {
utils.GetLogInstance().Info("Set DRand Leader PubKey", "key", node.Consensus.GetLeaderPubKey()) // utils.GetLogInstance().Info("Set DRand Leader PubKey", "key", node.Consensus.GetLeaderPubKey())
} //}
peers := make([]*p2p.Peer, 0) peers := make([]*p2p.Peer, 0)
@ -564,7 +564,8 @@ func (node *Node) pongMessageHandler(msgPayload []byte) int {
node.serviceManager.TakeAction(&service.Action{Action: service.Notify, ServiceType: service.PeerDiscovery, Params: data}) node.serviceManager.TakeAction(&service.Action{Action: service.Notify, ServiceType: service.PeerDiscovery, Params: data})
// TODO: remove this after fully migrating to beacon chain-based committee membership // TODO: remove this after fully migrating to beacon chain-based committee membership
return node.Consensus.UpdatePublicKeys(publicKeys) + node.DRand.UpdatePublicKeys(publicKeys) // return node.Consensus.UpdatePublicKeys(publicKeys) + node.DRand.UpdatePublicKeys(publicKeys)
return 0
} }
func (node *Node) epochShardStateMessageHandler(msgPayload []byte) int { func (node *Node) epochShardStateMessageHandler(msgPayload []byte) int {

Loading…
Cancel
Save