From 7268d7e13533d16bb9a67c6015f65ebd2c24e37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20RIBEAU?= Date: Wed, 19 Jun 2024 10:49:44 +0200 Subject: [PATCH] fix peers counting in routing table --- protocols/kad/src/behaviour.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/protocols/kad/src/behaviour.rs b/protocols/kad/src/behaviour.rs index 0133c2733c5..d09cea65860 100644 --- a/protocols/kad/src/behaviour.rs +++ b/protocols/kad/src/behaviour.rs @@ -1392,7 +1392,12 @@ where /// table is currently small (less that `K_VALUE` peers are present) and only /// trigger a bootstrap in that case fn bootstrap_on_low_peers(&mut self) { - if self.kbuckets().count() < K_VALUE.get() { + if self + .kbuckets() + .map(|kbucket| kbucket.num_entries()) + .sum::() + < K_VALUE.get() + { self.bootstrap_status.trigger(); } }