celo-blockchain
celo-blockchain copied to clipboard
When removing ValidatorPurpose peers, all remote nodes with that purpose should be considered, not just those currently peered with
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
Github closed this automatically when I merged in #1191, but that PR is not a full fix, so I reopened the issue
To check if it's still happening.