Remove peers from sender queue after validator change.
afck opened this issue · 1 comments
The sender queue already automatically adds peers based on StateChange::InProgress
, so that joining nodes are guaranteed to receive their messages. It should also remove peers that have left the network:
SenderQueue
probably needs a map that assigns to each peer the epoch after which they left, which would be updated in update_epoch
. Then defer_messages
would drop all messages from later epochs. When all outgoing messages to a removed peer have been sent, the peer can be removed from both maps.
Adding some more detail to this, I think removing peers can be done on ChangeState::Complete(Change::NodeChange(pub_keys))
:
-
by first adding those existing validators not in
pub_keys
to this new map, call itlast_epochs
; -
for each such validator, sending all messages to it up to its last epoch (this implies that the sending node has advanced past the last epoch), then removing that validator from both
peer_epochs
andlast_epochs
.