Merge pull request #505 from LeoHChen/debug

[debug] remove excessive logging on receiving messages
pull/506/head
Leo Chen 6 years ago committed by GitHub
commit 337e19d2b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      consensus/consensus.go
  2. 4
      node/node.go
  3. 12
      node/node_handler.go

@ -308,7 +308,6 @@ func verifyMessageSig(signerPubKey *bls.PublicKey, message *msg_pb.Message) erro
return err return err
} }
msgHash := sha256.Sum256(messageBytes) msgHash := sha256.Sum256(messageBytes)
utils.GetLogInstance().Debug("verifyMessageSig")
if !msgSig.VerifyHash(signerPubKey, msgHash[:]) { if !msgSig.VerifyHash(signerPubKey, msgHash[:]) {
return errors.New("failed to verify the signature") return errors.New("failed to verify the signature")
} }

@ -174,7 +174,7 @@ type Node struct {
clientReceiver p2p.GroupReceiver clientReceiver p2p.GroupReceiver
// Duplicated Ping Message Received // Duplicated Ping Message Received
duplicatedPing map[string]bool duplicatedPing sync.Map
// Channel to notify consensus service to really start consensus // Channel to notify consensus service to really start consensus
startConsensus chan struct{} startConsensus chan struct{}
@ -291,8 +291,6 @@ func New(host p2p.Host, consensusObj *consensus.Consensus, db ethdb.Database) *N
// start the goroutine to receive group message // start the goroutine to receive group message
go node.ReceiveGroupMessage() go node.ReceiveGroupMessage()
node.duplicatedPing = make(map[string]bool)
if utils.UseLibP2P { if utils.UseLibP2P {
node.startConsensus = make(chan struct{}) node.startConsensus = make(chan struct{})
} else { } else {

@ -132,10 +132,10 @@ func (node *Node) messageHandler(content []byte, sender string) {
case proto.Consensus: case proto.Consensus:
msgPayload, _ := proto.GetConsensusMessagePayload(content) msgPayload, _ := proto.GetConsensusMessagePayload(content)
if consensusObj.IsLeader { if consensusObj.IsLeader {
utils.GetLogInstance().Info("NET: Leader received consensus message") // utils.GetLogInstance().Info("NET: Leader received consensus message")
consensusObj.ProcessMessageLeader(msgPayload) consensusObj.ProcessMessageLeader(msgPayload)
} else { } else {
utils.GetLogInstance().Info("NET: Validator received consensus message") // utils.GetLogInstance().Info("NET: Validator received consensus message")
consensusObj.ProcessMessageValidator(msgPayload) consensusObj.ProcessMessageValidator(msgPayload)
// TODO(minhdoan): add logic to check if the current blockchain is not sync with other consensus // TODO(minhdoan): add logic to check if the current blockchain is not sync with other consensus
// we should switch to other state rather than DoingConsensus. // we should switch to other state rather than DoingConsensus.
@ -144,10 +144,10 @@ func (node *Node) messageHandler(content []byte, sender string) {
msgPayload, _ := proto.GetDRandMessagePayload(content) msgPayload, _ := proto.GetDRandMessagePayload(content)
if node.DRand != nil { if node.DRand != nil {
if node.DRand.IsLeader { if node.DRand.IsLeader {
utils.GetLogInstance().Info("NET: DRand Leader received message") // utils.GetLogInstance().Info("NET: DRand Leader received message")
node.DRand.ProcessMessageLeader(msgPayload) node.DRand.ProcessMessageLeader(msgPayload)
} else { } else {
utils.GetLogInstance().Info("NET: DRand Validator received message") // utils.GetLogInstance().Info("NET: DRand Validator received message")
node.DRand.ProcessMessageValidator(msgPayload) node.DRand.ProcessMessageValidator(msgPayload)
} }
} }
@ -343,9 +343,9 @@ func (node *Node) AddNewBlock(newBlock *types.Block) {
func (node *Node) pingMessageHandler(msgPayload []byte, sender string) int { func (node *Node) pingMessageHandler(msgPayload []byte, sender string) int {
if sender != "" { if sender != "" {
_, ok := node.duplicatedPing[sender] _, ok := node.duplicatedPing.Load(sender)
if !ok { if !ok {
node.duplicatedPing[sender] = true node.duplicatedPing.Store(sender, true)
} else { } else {
// duplicated ping message return // duplicated ping message return
return 0 return 0

Loading…
Cancel
Save