From 7fca1a627aa22232a70f93ef71e65ebc94fd5748 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 8 Mar 2022 19:36:02 +0100 Subject: [PATCH] xin-144 avoid duplicate messages (#68) * avoid duplicate messages * update comment --- eth/handler.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eth/handler.go b/eth/handler.go index 3978caa76f..10f1814be1 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -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)