lmdb: do not include blocked peers in selection of peer, count also blocked peers to use fallback .zip download

This commit is contained in:
ardocrat
2026-05-15 15:14:47 +03:00
parent c4f054ab51
commit a81f59926c
+4 -7
View File
@@ -377,7 +377,10 @@ impl StateSync {
// abort PIBD and fall back to txhashset download
// Waiting a minute helps ensures that the cancellation isn't simply due to a single non-PIBD enabled
// peer having the max difficulty
if available_pibd_peers().count() == 0 {
if available_pibd_peers()
.with_filter(|p| !peers.is_blocked(p.info.addr))
.count() == 0
{
if let None = self.earliest_zero_pibd_peer_time {
self.set_earliest_zero_pibd_peer_time(Some(Utc::now()));
}
@@ -422,12 +425,6 @@ impl StateSync {
.with_filter(|p| !peers.is_blocked(p.info.addr))
.exclude(excluded_peer)
.choose_random()
.or_else(|| {
// Select from blocked if we have no peers (could be network issue).
available_pibd_peers()
.exclude(excluded_peer)
.choose_random()
})
});
trace!("Chosen peer is {:?}", peer);