Currently, we have an LRU
|
known_statements: LruHashSet::new( |
, with the maximum amount of known statements per peer.
This prevents peers from sending us duplicates, but the LRU is limited in size, so a peer could possibly try to send us continuously valid statements to avoid punishments and if the set of valid statements is higher than the LRU size it could repeat this and trick the node in not punishing it while continuously hitting the statement-store index which is slower than an access in the LRU.
The LRU size is already pretty high, 2M statements, to make things more robust and prevent peers from continuously sending us duplicates that end up calling the statement-store, we should rate limit how many valid statements we accept from peer.
The limit should be high enough to guarantee we are not throttling valid use-cases.