OSDN Git Service

Fix consensus msg sync bugs (#150)
authoryahtoo <yahtoo.ma@gmail.com>
Mon, 10 Jun 2019 09:27:51 +0000 (17:27 +0800)
committerPaladz <yzhu101@uottawa.ca>
Mon, 10 Jun 2019 09:27:51 +0000 (17:27 +0800)
fix peer status update error
fix block signature mark error

netsync/consensusmgr/handle.go

index 66fddd9..bf21b6f 100644 (file)
@@ -91,6 +91,7 @@ func (m *Manager) handleBlockProposeMsg(peerID string, msg *BlockProposeMsg) {
        hash := block.Hash()
        m.peers.MarkBlock(peerID, &hash)
        m.blockFetcher.processNewBlock(&blockMsg{peerID: peerID, block: block})
+       m.peers.SetStatus(peerID, block.Height, &hash)
 }
 
 func (m *Manager) handleBlockSignatureMsg(peerID string, msg *BlockSignatureMsg) {
@@ -99,6 +100,7 @@ func (m *Manager) handleBlockSignatureMsg(peerID string, msg *BlockSignatureMsg)
                m.peers.ProcessIllegal(peerID, security.LevelMsgIllegal, err.Error())
                return
        }
+       m.peers.MarkBlockSignature(peerID, msg.Signature)
 }
 
 func (m *Manager) blockProposeMsgBroadcastLoop() {