Expected Behavior
When calling ClearValidatorPeers or ReplaceValidatorPeers, we should consider all nodes that are have the static/trusted purpose ValidatorPurpose, not just those that are currently peered with.
Current Behavior
We currently iterate through all current peers. In the event that a remote ValidatorPurpose peer has already disconnected (which has a high chance of happening if the current node becomes unelected) by the time the current node wants to remove all ValidatorPurpose peers, those remote peers that have already disconnected will still remain as trusted/static ValidatorPurpose peers. This results in the current node continuing to peer with them, even though they shouldn't.
Steps to Reproduce Behavior
Unelect a validator, look at the logs after the epoch change
Logs
n/a
System information
n/a