The original implementation of peer eviction prioritized aliveness over connection stability which made the peer count unstable for some users.
As this may cause discomfort or infrastructure alerts if stability is tracked, adjust the eviction to be less aggressive by only evicting peers when the node has fully stalled. This causes the node to have some peers who are inactive and won't send any block announcements. These nodes are removed if the local node is able to receive at least one block announcement from one of its peers as the inactivity of the substream is detected when a notification is sent.
If the node won't send or receive any block annoucements for 30 seconds, it's considered stalled and it will evict all peers, causing ProtocolController to accept and establish connections from new peers.
The original implementation of peer eviction prioritized aliveness over connection stability which made the peer count unstable for some users.
As this may cause discomfort or infrastructure alerts if stability is tracked, adjust the eviction to be less aggressive by only evicting peers when the node has fully stalled. This causes the node to have some peers who are inactive and won't send any block announcements. These nodes are removed if the local node is able to receive at least one block announcement from one of its peers as the inactivity of the substream is detected when a notification is sent.
If the node won't send or receive any block annoucements for 30 seconds, it's considered stalled and it will evict all peers, causing
ProtocolController
to accept and establish connections from new peers.