This implements the follow-up suggested here: #18861 (comment) . Instead of checking setInventoryTxToSend
, maintain an explicit bloom filter with the 3500 most recently announced invs, and permit fetching any of these as long as they’re in the relay pool or the mempool. In addition, permit relay from the mempool after just 2 minutes instead of 15.
This:
- Fixes the brief opportunity an attacker has to request unannounced invs just after the connection is established (pointed out by naumenkogs, see #18861 (comment)).
- Guarantees that locally resubmitted invs after
filterInventoryKnown
rolls over can still be requested (pointed out by luke-jr, see #18861 (review)).
It adds 37 KiB of filter per peer.
This is also a step towards dropping the relay pool entirely and always relaying from the mempool directly (see #17303), but that is still blocked by dealing properly with NOTFOUNDs (see #18238).