aboutsummaryrefslogtreecommitdiffstats
path: root/dex/peer.go
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2019-03-21 15:57:28 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-21 15:57:28 +0800
commit6348a33fc6274538e94ab2aba6efbe578d4c6914 (patch)
treeb5e5b9117a9d9ac5d9fafa000226bfefb01b1cee /dex/peer.go
parentacc1494299427a2461956307a2586192ad0a5d83 (diff)
downloaddexon-6348a33fc6274538e94ab2aba6efbe578d4c6914.tar
dexon-6348a33fc6274538e94ab2aba6efbe578d4c6914.tar.gz
dexon-6348a33fc6274538e94ab2aba6efbe578d4c6914.tar.bz2
dexon-6348a33fc6274538e94ab2aba6efbe578d4c6914.tar.lz
dexon-6348a33fc6274538e94ab2aba6efbe578d4c6914.tar.xz
dexon-6348a33fc6274538e94ab2aba6efbe578d4c6914.tar.zst
dexon-6348a33fc6274538e94ab2aba6efbe578d4c6914.zip
dex: reduce msg when broadcast tx (#292)
Our network topology is different from ethereum, the nodes in notary set will connect each other directly. So there is a waste for flooding tx msgs in notary set. And nodes in notary set are more likely to propose block successfully, it is not useful to broadcast tx msgs to non notary set nodes. This PR will increase some tx confirm latency, but can reduce waste tx msgs a lot.
Diffstat (limited to 'dex/peer.go')
-rw-r--r--dex/peer.go15
1 files changed, 0 insertions, 15 deletions
diff --git a/dex/peer.go b/dex/peer.go
index f92fce130..562cbfaca 100644
--- a/dex/peer.go
+++ b/dex/peer.go
@@ -854,21 +854,6 @@ func (ps *peerSet) PeersWithoutBlock(hash common.Hash) []*peer {
return list
}
-// PeersWithoutTx retrieves a list of peers that do not have a given transaction
-// in their set of known hashes.
-func (ps *peerSet) PeersWithoutTx(hash common.Hash) []*peer {
- ps.lock.RLock()
- defer ps.lock.RUnlock()
-
- list := make([]*peer, 0, len(ps.peers))
- for _, p := range ps.peers {
- if !p.knownTxs.Contains(hash) {
- list = append(list, p)
- }
- }
- return list
-}
-
func (ps *peerSet) PeersWithLabel(label peerLabel) []*peer {
ps.lock.RLock()
defer ps.lock.RUnlock()