decred / dcrd

Decred daemon in Go (golang).
https://decred.org
ISC License
731 stars 289 forks source link

peer: Randomize inv batching delays #3363

Closed jrick closed 1 month ago

jrick commented 1 month ago

This changes the inventory batching delay from a static 500ms ticker to a random delay uniformly distributed between 100-500ms. The intention is to improve privacy while simultaneously increasing the network propagation speed of inventoried messages (including transactions, blocks, and mixing messages) and continuing to keep inventory batching useful and occurring when many messages are inventoried in the same short duration.

As this change rolls out to more nodes on the network, this will cause not only more random jitter into the sending and timing of messages, but also change the message paths. Currently, with every peer using a 500ms ticker, if no changes occur to the graph of connected nodes, messages will always propagate the nodes in the same order. However, if all nodes are randomizing their inventory batching delays, the next peer who will relay a message first during the next hop will always be different.