diff --git a/pkg/topology/kademlia/kademlia.go b/pkg/topology/kademlia/kademlia.go index 16b414e2025..5a91e4f5edf 100644 --- a/pkg/topology/kademlia/kademlia.go +++ b/pkg/topology/kademlia/kademlia.go @@ -1136,8 +1136,8 @@ func (k *Kad) AddPeers(addrs ...swarm.Address) { func (k *Kad) Pick(peer p2p.Peer) bool { k.metrics.PickCalls.Inc() - if k.bootnode { - // shortcircuit for bootnode mode - always accept connections, + if k.bootnode || !peer.FullNode { + // shortcircuit for bootnode mode AND light node peers - always accept connections, // at least until we find a better solution. return true } diff --git a/pkg/topology/kademlia/kademlia_test.go b/pkg/topology/kademlia/kademlia_test.go index feb910ac401..67bc0f2e362 100644 --- a/pkg/topology/kademlia/kademlia_test.go +++ b/pkg/topology/kademlia/kademlia_test.go @@ -552,9 +552,12 @@ func TestOversaturation(t *testing.T) { // if error is not as specified, connectOne goes fatal connectOne(t, signer, kad, ab, addr, topology.ErrOversaturated) // check that pick works correctly - if kad.Pick(p2p.Peer{Address: addr}) { + if kad.Pick(p2p.Peer{Address: addr, FullNode: true}) { t.Fatal("should not pick the peer") } + if !kad.Pick(p2p.Peer{Address: addr, FullNode: false}) { + t.Fatal("should pick the peer") + } } // see depth is still as expected kDepth(t, kad, 5)