mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Don't connect to reserved nodes if they're banned (#9020)
This commit is contained in:
@@ -444,6 +444,8 @@ impl Peerset {
|
||||
set_id: SetId(set_index),
|
||||
peer_id: peer.into_peer_id(),
|
||||
});
|
||||
|
||||
self.alloc_slots(SetId(set_index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -524,6 +526,14 @@ impl Peerset {
|
||||
peersstate::Peer::Connected(_) => continue,
|
||||
};
|
||||
|
||||
// Don't connect to nodes with an abysmal reputation, even if they're reserved.
|
||||
// This is a rather opinionated behaviour, and it wouldn't be fundamentally wrong to
|
||||
// remove that check. If necessary, the peerset should be refactored to give more
|
||||
// control over what happens in that situation.
|
||||
if entry.reputation() < BANNED_THRESHOLD {
|
||||
break;
|
||||
}
|
||||
|
||||
match entry.try_outgoing() {
|
||||
Ok(conn) => self.message_queue.push_back(Message::Connect {
|
||||
set_id,
|
||||
|
||||
Reference in New Issue
Block a user