This is based upon and partially replaces #5989, and rebased on top of #7100.
We used to have a trickle node, a node which was chosen in each iteration of the send loop that was privileged and allowed to send out queued up non-time critical messages. Since the removal of the fixed sleeps in the network code, this resulted in fast and attackable (see #7123) treatment of such broadcasts.
This pull request changes each of these trickle-dependant mechanisms with a per-node and per-feature random delay timer, improving privacy and performance by making queueing useful again.
The commits are mostly squashed/rebased versions taken from #5989 by @pstratem, except:
- No randomization of tx invs (more code changes, and may not interact well with transactions that need to be sent after their dependencies).
- No removal of the “1/4 blast to all” behaviour, as #7123 proposes an alternative.
- No removal of the “announce yourself to outbound peers” behaviour.