diff --git a/message/message.go b/message/message.go index db4696263..78af3854c 100644 --- a/message/message.go +++ b/message/message.go @@ -10,13 +10,14 @@ Node will process the content of the p2p message ---- content start ----- 1 byte - message category - 0x00: consensus - 0x01: normal... -1 byte - action type - - consensus node + 0x00: COMMITTEE + 0x01: NODE... +1 byte - message type + - for COMMITTEE category 0x00: consensus - - normal node - 0x00: transaction + 0x01: sharding ... + - for NODE category + 0x00: transaction ... n - 2 bytes - actual message payload ---- content end ----- diff --git a/node/node.go b/node/node.go index d3d96cc28..ff7d60c8c 100644 --- a/node/node.go +++ b/node/node.go @@ -46,7 +46,7 @@ func (node *Node) NodeHandler(conn net.Conn) { defer conn.Close() // Read p2p message payload - payload, err := p2p.ReadMessageContent(conn) + content, err := p2p.ReadMessageContent(conn) consensus := node.consensus if err != nil { @@ -58,7 +58,7 @@ func (node *Node) NodeHandler(conn net.Conn) { return } - msgCategory, err := message.GetMessageCategory(payload) + msgCategory, err := message.GetMessageCategory(content) if err != nil { if consensus.IsLeader { log.Printf("[Leader] Read node type failed:%s", err) @@ -68,7 +68,7 @@ func (node *Node) NodeHandler(conn net.Conn) { return } - msgType, err := message.GetMessageType(payload) + msgType, err := message.GetMessageType(content) if err != nil { if consensus.IsLeader { log.Printf("[Leader] Read action type failed:%s", err) @@ -78,7 +78,7 @@ func (node *Node) NodeHandler(conn net.Conn) { return } - msgPayload, err := message.GetMessagePayload(payload) + msgPayload, err := message.GetMessagePayload(content) if err != nil { if consensus.IsLeader { log.Printf("[Leader] Read message payload failed:%s", err)