From 3155f92f8f6c8018877c715c9b58bfbe19bfb8ea Mon Sep 17 00:00:00 2001 From: Sonic Date: Thu, 21 Mar 2019 15:57:28 +0800 Subject: 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. --- dex/peer.go | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'dex/peer.go') 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() -- cgit