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@byzantine-lab.io>2019-06-12 17:27:16 +0800
commit4038a460b537083b2395fc1d443ebffe6a739d23 (patch)
tree280a050d6f6350ef048937e6cb42465cae5f4a46 /dex
parente8326992de2ed9b961570b7379b0c091f1f9e051 (diff)
downloadgo-tangerine-4038a460b537083b2395fc1d443ebffe6a739d23.tar.gz
go-tangerine-4038a460b537083b2395fc1d443ebffe6a739d23.tar.zst
go-tangerine-4038a460b537083b2395fc1d443ebffe6a739d23.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)