diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-23 12:05:43 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 13:49:54 +0800 |
commit | 2ddf575853e1d5162c4b3c11c80bb452cb7d8b70 (patch) | |
tree | e2fe8821ec185d5a5dc8c72e68373a9fe525d3fc /dex | |
parent | 28d4e46de9d79952861d23950a5b5116fdbeebea (diff) | |
download | dexon-2ddf575853e1d5162c4b3c11c80bb452cb7d8b70.tar dexon-2ddf575853e1d5162c4b3c11c80bb452cb7d8b70.tar.gz dexon-2ddf575853e1d5162c4b3c11c80bb452cb7d8b70.tar.bz2 dexon-2ddf575853e1d5162c4b3c11c80bb452cb7d8b70.tar.lz dexon-2ddf575853e1d5162c4b3c11c80bb452cb7d8b70.tar.xz dexon-2ddf575853e1d5162c4b3c11c80bb452cb7d8b70.tar.zst dexon-2ddf575853e1d5162c4b3c11c80bb452cb7d8b70.zip |
dex: prevent broadcasting agreement and randomness indefinitely
Diffstat (limited to 'dex')
-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) |