diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-23 12:05:43 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | 72d59f7d765607bd6aafeb836e6034c22a5eb877 (patch) | |
tree | 1355732e9d3f8de3d6f717a7d0014f0c0a17cf71 /dex/handler.go | |
parent | d6e47bac7bf55736ff6bad87a77c1452891aa6e3 (diff) | |
download | dexon-72d59f7d765607bd6aafeb836e6034c22a5eb877.tar dexon-72d59f7d765607bd6aafeb836e6034c22a5eb877.tar.gz dexon-72d59f7d765607bd6aafeb836e6034c22a5eb877.tar.bz2 dexon-72d59f7d765607bd6aafeb836e6034c22a5eb877.tar.lz dexon-72d59f7d765607bd6aafeb836e6034c22a5eb877.tar.xz dexon-72d59f7d765607bd6aafeb836e6034c22a5eb877.tar.zst dexon-72d59f7d765607bd6aafeb836e6034c22a5eb877.zip |
dex: prevent broadcasting agreement and randomness indefinitely
Diffstat (limited to 'dex/handler.go')
-rw-r--r-- | dex/handler.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/dex/handler.go b/dex/handler.go index 87f8b6b1d..2b7e1cee1 100644 --- a/dex/handler.go +++ b/dex/handler.go @@ -854,7 +854,9 @@ func (pm *ProtocolManager) BroadcastAgreementResult( round: agreement.Position.Round, } for _, peer := range pm.peers.PeersWithLabel(label) { - peer.AsyncSendAgreement(agreement) + if !peer.knownAgreements.Contains(rlpHash(agreement)) { + peer.AsyncSendAgreement(agreement) + } } // TODO(sonic): send to some of other nodes (gossip) @@ -872,7 +874,9 @@ func (pm *ProtocolManager) BroadcastRandomnessResult( round: randomness.Position.Round, } for _, peer := range pm.peers.PeersWithLabel(label) { - peer.AsyncSendRandomness(randomness) + if !peer.knownRandomnesses.Contains(rlpHash(randomness)) { + peer.AsyncSendRandomness(randomness) + } } // TODO(sonic): send to some of other nodes (gossip) |