Skip to content

Commit

Permalink
xin-144 avoid duplicate messages (ethereum#68)
Browse files Browse the repository at this point in the history
* avoid duplicate messages

* update comment
  • Loading branch information
liam-lai authored Mar 8, 2022
1 parent 8363641 commit 7fca1a6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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)

Expand Down

0 comments on commit 7fca1a6

Please sign in to comment.