Skip to content
This repository was archived by the owner on May 22, 2023. It is now read-only.

Commit c314177

Browse files
tomakaAndrei Navoichyk
authored andcommitted
Don't connect to reserved nodes if they're banned (paritytech#9020)
1 parent 7b6a0ee commit c314177

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

client/peerset/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ impl Peerset {
444444
set_id: SetId(set_index),
445445
peer_id: peer.into_peer_id(),
446446
});
447+
448+
self.alloc_slots(SetId(set_index));
447449
}
448450
}
449451
}
@@ -524,6 +526,14 @@ impl Peerset {
524526
peersstate::Peer::Connected(_) => continue,
525527
};
526528

529+
// Don't connect to nodes with an abysmal reputation, even if they're reserved.
530+
// This is a rather opinionated behaviour, and it wouldn't be fundamentally wrong to
531+
// remove that check. If necessary, the peerset should be refactored to give more
532+
// control over what happens in that situation.
533+
if entry.reputation() < BANNED_THRESHOLD {
534+
break;
535+
}
536+
527537
match entry.try_outgoing() {
528538
Ok(conn) => self.message_queue.push_back(Message::Connect {
529539
set_id,

0 commit comments

Comments
 (0)