We ban a peer if we receive (or send) excessive numbers of messages to/from that peer within a 60s time period.
The limit is 500 messages within 60s. If we see more than this then the peer is flagged as abusive and eventually banned.
It makes sense to monitor this for inbound received messages but I'm not convinced this is the right thing to do when we initiate requests by sending messages to peers.
Specifically this is an issue if we request large numbers of blocks from a small number of peers (say those that support full archive mode) as we can easily hit the 500 msg limit when requesting historical blocks.
Proposal is to limit the abusive peer handling to inbound msgs only. If we engage in abusive behavior when sending messages to a peer then they will react accordingly. We do not need to ban them for something we are responsible for.
We would need to monitor (and rate limit) our outbound msg rates to ensure we did not exceed peer limits.
We can do this by inspecting the Tracker (msg rates) associated with each peer and potentially rate limit by introducing a small delay across large numbers of outbound "get_block" requests.
Exploration/investigation into full block archive sync identified an issue relating to banning abusive peers.
Related https://github.com/mimblewimble/grin/issues/3552
We ban a peer if we receive (or send) excessive numbers of messages to/from that peer within a 60s time period.
The limit is 500 messages within 60s. If we see more than this then the peer is flagged as abusive and eventually banned.
It makes sense to monitor this for inbound received messages but I'm not convinced this is the right thing to do when we initiate requests by sending messages to peers. Specifically this is an issue if we request large numbers of blocks from a small number of peers (say those that support full archive mode) as we can easily hit the 500 msg limit when requesting historical blocks.
Proposal is to limit the abusive peer handling to inbound msgs only. If we engage in abusive behavior when sending messages to a peer then they will react accordingly. We do not need to ban them for something we are responsible for.
We would need to monitor (and rate limit) our outbound msg rates to ensure we did not exceed peer limits. We can do this by inspecting the
Tracker
(msg rates) associated with each peer and potentially rate limit by introducing a small delay across large numbers of outbound "get_block" requests.