This is a re-attempt of #28765
The main differences from it are:
- Most outstanding comments have been addressed (or responded to on the original PR)
- The description of how a node is picked in
IsFanoutTarget
has been updated to reflect what the algorithm is doing (not how it is doing it) - The way
hash_key
is seeded inIsFanoutTarget
has changed (fromm_k0
tonode_id
). This is to prevent usingm_k0
for something it is not intended to, given what data we feed to the randomizer should not matter for this - The cache in
IsFanoutTarget
was only being fed data to, but never checked. This has been reworked to make use of it destinations/target
has been renamed ton
inShouldFanoutTo/IsFanoutTarget
- The PR has been rebased
Also, the following things have been added/changed to the approach:
- Deal with short id collisions by fanning out both transactions
- Deal with ancestors being present on the mempool when a child needs to be placed in the fanout or reconciliation sets (as opposed to dealing with parents, which was the wrong approach)
- Move fanout/reconcile logic from INV creation to
RelayTransaction
- Create a delayed set where transactions that are added for reconciliation but still not offered to peers (for privacy reasons) live. This is analogous to how fanout works, where transactions are only made available on trickle intervals
Erlay Project Tracking: https://github.com/bitcoin/bitcoin/issues/30249