xin-144 avoid duplicate messages (#68)

* avoid duplicate messages

* update comment
This commit is contained in:
Liam 2022-03-08 19:36:02 +01:00 committed by GitHub
parent 8363641b2c
commit 7fca1a627a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -831,6 +831,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
return errResp(ErrDecode, "msg %v: %v", msg, err)
}
// Mark the peer as owning the vote and process it
// because peer has 2 address sender and receive, so use p.id to find the right address
p = pm.peers.Peer(p.id)
p.MarkVote(vote.Hash())
pm.bft.Vote(&vote)
case msg.Code == TimeoutMsg:
@ -840,6 +842,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
}
// Mark the peer as owning the timeout and process it
// because peer has 2 address sender and receive, so use p.id to find the right address
p = pm.peers.Peer(p.id)
p.MarkTimeout(timeout.Hash())
pm.bft.Timeout(&timeout)
case msg.Code == SyncInfoMsg:
@ -848,6 +852,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
return errResp(ErrDecode, "msg %v: %v", msg, err)
}
// Mark the peer as owning the syncInfo and process it
// because peer has 2 address sender and receive, so use p.id to find the right address
p = pm.peers.Peer(p.id)
p.MarkSyncInfo(syncInfo.Hash())
pm.bft.SyncInfo(&syncInfo)