diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-23 12:05:43 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2018-12-19 20:54:27 +0800 |
commit | 0456cd5a89b340fec7d48ef684a041e726a321c3 (patch) | |
tree | ee6397ad98be65fd51ee3b548ca8e919733a076f /dex | |
parent | 5a4b1cbce0cba3af5492646d01ee5d9c0b2a6a72 (diff) | |
download | dexon-0456cd5a89b340fec7d48ef684a041e726a321c3.tar dexon-0456cd5a89b340fec7d48ef684a041e726a321c3.tar.gz dexon-0456cd5a89b340fec7d48ef684a041e726a321c3.tar.bz2 dexon-0456cd5a89b340fec7d48ef684a041e726a321c3.tar.lz dexon-0456cd5a89b340fec7d48ef684a041e726a321c3.tar.xz dexon-0456cd5a89b340fec7d48ef684a041e726a321c3.tar.zst dexon-0456cd5a89b340fec7d48ef684a041e726a321c3.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) |