add addtional log message in transportation

Signed-off-by: Leo Chen <leo@harmony.one>
pull/76/head
Leo Chen 6 years ago
parent 1323877d61
commit 13dfea2e84
  1. 6
      consensus/consensus_leader.go
  2. 11
      node/node_handler.go

@ -173,12 +173,13 @@ func (consensus *Consensus) processCommitMessage(payload []byte, targetState Sta
point := crypto.Ed25519Curve.Point()
point.UnmarshalBinary(commitment)
(*commitments)[validatorID] = point
consensus.Log.Debug("Received new commit message", "num", len(*commitments))
consensus.Log.Debug("Received new commit message", "num", len(*commitments), "validatorID", validatorID)
// Set the bitmap indicate this validate signed. TODO: figure out how to resolve the inconsistency of validators from commit and response messages
bitmap.SetKey(value.PubKey, true)
}
if !shouldProcess {
consensus.Log.Debug("Received new commit message", "validatorID", validatorID)
return
}
@ -310,13 +311,14 @@ func (consensus *Consensus) processResponseMessage(payload []byte, targetState S
shouldProcess = false
} else {
(*responses)[validatorID] = responseScalar
consensus.Log.Debug("Received new response message", "num", len(*responses))
consensus.Log.Debug("Received new response message", "num", len(*responses), "validatorID", validatorID)
// Set the bitmap indicate this validate signed. TODO: figure out how to resolve the inconsistency of validators from commit and response messages
bitmap.SetKey(value.PubKey, true)
}
}
if !shouldProcess {
consensus.Log.Debug("Received new response message", "validatorID", validatorID)
return
}

@ -79,6 +79,7 @@ func (node *Node) NodeHandler(conn net.Conn) {
fmt.Println("received a identity message")
// TODO(ak): fix it.
// node.processPOWMessage(msgPayload)
node.log.Info("NET: received message: IDENTITY/REGISTER")
case proto_identity.Announce:
node.log.Error("Announce message should be sent to IdentityChain")
}
@ -88,8 +89,10 @@ func (node *Node) NodeHandler(conn net.Conn) {
switch actionType {
case consensus.Consensus:
if consensusObj.IsLeader {
node.log.Info("NET: received message: Consensus/Leader")
consensusObj.ProcessMessageLeader(msgPayload)
} else {
node.log.Info("NET: received message: Consensus/Validator")
consensusObj.ProcessMessageValidator(msgPayload)
}
}
@ -97,8 +100,10 @@ func (node *Node) NodeHandler(conn net.Conn) {
actionType := proto_node.NodeMessageType(msgType)
switch actionType {
case proto_node.Transaction:
node.log.Info("NET: received message: Node/Transaction")
node.transactionMessageHandler(msgPayload)
case proto_node.BLOCK:
node.log.Info("NET: received message: Node/BLOCK")
blockMsgType := proto_node.BlockMessageType(msgPayload[0])
switch blockMsgType {
case proto_node.Sync:
@ -110,8 +115,10 @@ func (node *Node) NodeHandler(conn net.Conn) {
}
}
case proto_node.BlockchainSync:
node.log.Info("NET: received message: Node/BlockchainSync")
node.handleBlockchainSync(msgPayload, conn)
case proto_node.CLIENT:
node.log.Info("NET: received message: Node/CLIENT")
clientMsgType := proto_node.ClientMessageType(msgPayload[0])
switch clientMsgType {
case proto_node.LookupUtxo:
@ -125,6 +132,7 @@ func (node *Node) NodeHandler(conn net.Conn) {
p2p.SendMessage(fetchUtxoMessage.Sender, client.ConstructFetchUtxoResponseMessage(&utxoMap, node.UtxoPool.ShardID))
}
case proto_node.CONTROL:
node.log.Info("NET: received message: Node/CONTROL")
controlType := msgPayload[0]
if proto_node.ControlMessageType(controlType) == proto_node.STOP {
node.log.Debug("Stopping Node", "node", node, "numBlocks", len(node.blockchain.Blocks), "numTxsProcessed", node.countNumTransactionsInBlockchain())
@ -172,6 +180,7 @@ func (node *Node) NodeHandler(conn net.Conn) {
}
case proto.CLIENT:
actionType := client.ClientMessageType(msgType)
node.log.Info("NET: received message: CLIENT/Transaction")
switch actionType {
case client.Transaction:
if node.Client != nil {
@ -357,7 +366,7 @@ func (node *Node) SendBackProofOfAcceptOrReject() {
// NOTE: For now, just send to the client (basically not broadcasting)
func (node *Node) BroadcastNewBlock(newBlock *blockchain.Block) {
if node.ClientPeer != nil {
node.log.Debug("SENDING NEW BLOCK TO CLIENT")
node.log.Debug("NET: SENDING NEW BLOCK TO CLIENT")
p2p.SendMessage(*node.ClientPeer, proto_node.ConstructBlocksSyncMessage([]blockchain.Block{*newBlock}))
}
}

Loading…
Cancel
Save