Prevents a DoS attack by a peer who keeps requesting large amounts of the same blocks. We disconnect as soon as we encounter a repetitive request, and it is allowed again after INBOUND_BLOCK_REQUEST_INTERVAL = 60 seconds.
I tried to re-use the Cache abstraction without imposing too many additional assumptions.
Test Plan
Added some unit tests, but this should definitely be tested on a running network.
Motivation
Prevents a DoS attack by a peer who keeps requesting large amounts of the same blocks. We disconnect as soon as we encounter a repetitive request, and it is allowed again after
INBOUND_BLOCK_REQUEST_INTERVAL = 60 seconds
.I tried to re-use the Cache abstraction without imposing too many additional assumptions.
Test Plan
Added some unit tests, but this should definitely be tested on a running network.
Related PRs
Extends: https://github.com/AleoHQ/snarkOS/pull/3223