Correct some comments and variable names

pull/5/head
Rongjian Lan 7 years ago
parent 4129232928
commit 4e0b706c0d
  1. 13
      message/message.go
  2. 8
      node/node.go

@ -10,13 +10,14 @@ Node will process the content of the p2p message
---- content start -----
1 byte - message category
0x00: COMMITTEE
0x01: NODE...
1 byte - message type
- for COMMITTEE category
0x00: consensus
0x01: normal...
1 byte - action type
- consensus node
0x00: consensus
- normal node
0x00: transaction
0x01: sharding ...
- for NODE category
0x00: transaction ...
n - 2 bytes - actual message payload
---- content end -----

@ -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)

Loading…
Cancel
Save