AleoNet / snarkOS

A Decentralized Operating System for ZK Applications
http://snarkos.org
Apache License 2.0
4.31k stars 2.62k forks source link

[Optimize] Do not `PeerRefresh` syncing peers. #3223

Closed raychu86 closed 5 months ago

raychu86 commented 5 months ago

Motivation

This PR adds 2 changes:

  1. A cache for inbound_block_requests to limit the number of block requests a node can send every minute.
  2. Prevent PeerRefresh on peers that are syncing from you or if you are syncing from that peer.

Note: The current rate limit is quite generous at 256 block requests every 60 seconds.