aboutsummaryrefslogtreecommitdiffstats
path: root/les
diff options
context:
space:
mode:
authorAndrey Petrov <shazow@gmail.com>2018-02-27 18:52:59 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-02-27 18:52:59 +0800
commit2e9c8fd4fbd5d0de0ced03961d268c7492917860 (patch)
tree83ca6e575f5ac94a79245a58c7a237cb2086e0ef /les
parent4c845bdc271c46706ea4af248a1efec8683dc53a (diff)
downloadgo-tangerine-2e9c8fd4fbd5d0de0ced03961d268c7492917860.tar.gz
go-tangerine-2e9c8fd4fbd5d0de0ced03961d268c7492917860.tar.zst
go-tangerine-2e9c8fd4fbd5d0de0ced03961d268c7492917860.zip
eth, les: allow exceeding maxPeers for trusted peers (#16189)
Fixes #3326, #14472
Diffstat (limited to 'les')
-rw-r--r--les/handler.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/les/handler.go b/les/handler.go
index 864abe605..9627f392b 100644
--- a/les/handler.go
+++ b/les/handler.go
@@ -260,7 +260,8 @@ func (pm *ProtocolManager) newPeer(pv int, nv uint64, p *p2p.Peer, rw p2p.MsgRea
// handle is the callback invoked to manage the life cycle of a les peer. When
// this function terminates, the peer is disconnected.
func (pm *ProtocolManager) handle(p *peer) error {
- if pm.peers.Len() >= pm.maxPeers {
+ // Ignore maxPeers if this is a trusted peer
+ if pm.peers.Len() >= pm.maxPeers && !p.Peer.Info().Network.Trusted {
return p2p.DiscTooManyPeers
}