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:
parent
0ec084fc23
commit
28c8c1531f
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue