Trickle in CNode::SendMessages



Summary:

The CNode::SendMessages function in the peer-to-peer network uses a trickle algorithm to send messages to nodes. At each update round, a new random trickle node is chosen from 120 nodes, and with an average round time of 100ms for sleep, all nodes are moved through roughly every 12-15 seconds. When a node is chosen as the trickle node, it sends all its pending addresses to its corresponding peer. However, when a node is not the trickle node, only 1/4 of transaction-invs are sent, while the rest are pushed to wait for the next round. The selection process for the 1/4 invs that get sent is based on a hashSalt constant generated during start-up, resulting in the other 3/4 never getting sent. It is suggested to remove the redundant vInvWait stuff or change the algorithm to push the tx'es into a multimap (invHash^hashSalt, invHash) and choose the first 25% in each round. The current implementation divides the inv forwarding hash space into 4, similar to DHTs. As long as there are more than four nodes, all transactions will be sent around, given the different hashSalt for each node in the peer-to-peer network.


Updated on: 2023-06-05T01:36:02.021466+00:00