aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-10-23 12:05:43 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:50 +0800
commit4395f2b17fcc20f733ee37c3e3e16664821015dc (patch)
treeada0a276dd91bb8ebe6992d1a51d923badc1bd87 /dex
parent77882898913a3e2ed0a0ce59090a4e62da39c58f (diff)
downloaddexon-4395f2b17fcc20f733ee37c3e3e16664821015dc.tar.gz
dexon-4395f2b17fcc20f733ee37c3e3e16664821015dc.tar.zst
dexon-4395f2b17fcc20f733ee37c3e3e16664821015dc.zip
dex: prevent broadcasting agreement and randomness indefinitely
Diffstat (limited to 'dex')
-rw-r--r--dex/handler.go8
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)