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 21:32:50 +0800 |
commit | 4395f2b17fcc20f733ee37c3e3e16664821015dc (patch) | |
tree | ada0a276dd91bb8ebe6992d1a51d923badc1bd87 | |
parent | 77882898913a3e2ed0a0ce59090a4e62da39c58f (diff) | |
download | dexon-4395f2b17fcc20f733ee37c3e3e16664821015dc.tar dexon-4395f2b17fcc20f733ee37c3e3e16664821015dc.tar.gz dexon-4395f2b17fcc20f733ee37c3e3e16664821015dc.tar.bz2 dexon-4395f2b17fcc20f733ee37c3e3e16664821015dc.tar.lz dexon-4395f2b17fcc20f733ee37c3e3e16664821015dc.tar.xz dexon-4395f2b17fcc20f733ee37c3e3e16664821015dc.tar.zst dexon-4395f2b17fcc20f733ee37c3e3e16664821015dc.zip |
dex: prevent broadcasting agreement and randomness indefinitely
-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) |