cli/sync: filter seeds without an address

If a seed for syncing does not have an address, the local node will not be able
to connect to it.

These can be filtered out so that no connection attempts are made for these nodes.
This commit is contained in:
Fintan Halpenny 2025-11-21 12:48:33 -03:00 committed by Lorenz Leutgeb
parent 0ec084fc23
commit 28c8c1531f
1 changed files with 4 additions and 1 deletions

View File

@ -281,7 +281,10 @@ pub fn fetch(
let candidates = connected
.into_iter()
.map(|seed| seed.nid)
.chain(disconnected.into_iter().map(|seed| seed.nid))
.chain(disconnected.into_iter().filter_map(|seed| {
// Only consider seeds that have at least one known address.
(!seed.addrs.is_empty()).then_some(seed.nid)
}))
.map(sync::fetch::Candidate::new);
sync::FetcherConfig::public(settings.seeds.clone(), settings.replicas, *local)
.with_candidates(candidates)