1
If a node has 100 connections to other nodes and receives a new transaction using a getData request, it sends an inv message to it's 100 connecting peers correct?
Does it also send the inv message to the peer that it just received the transaction from as it is still one of it's connecting peers?
'Messages, in general, are flushed periodically about every 100 ms. However, transaction relaying takes place by “trickling” messages out. Bitcoin randomly selects with a probability of 1/4 the transactions for an inv message and stalls the remaining transactions. Every neighbor gets a different set of randomly chosen transactions, each about 1/4 of the currently available set. Only the randomly selected “trickling node” (cf. addr message relaying) gets all transactions immediately. The other neighbors either get it later or already got it from another neighbor. Trickling reduces the overhead and at the same time makes traffic analysis more difficult, in a similar manner as mixes do in mix networks.'
I'm having a bit of difficulty understanding how trickling works in terms of transactions. I believed that the process was when a transaction occurs, the node responsible for the transaction would send INV messages to its peers and send the tx if the peers respond with getData.
Thanks a lot for your detailed answer. So if I understand this correctly, nodes will not sent an INV message to peers that it knows already has the transaction (i.e the peers that have already sent this node an INV to the same transaction). And when a node wants to send an tx INV to it's peers, it adds it to an already existing list of transactions that it wants to send to that specific peer. When it does send eventually, does this INV message contain multiple txID hashes or is it an INV per txid hash? – Herofire – 2018-12-19T12:48:37.233
When it does send, the
invshould contain multiple txids. However, it is possible (and perhaps likely), that by the time it does send aninv, there are only one or two txids for it to send. – Andrew Chow – 2018-12-19T16:38:06.0202It may be worth pointing out that the quotes in OP's question are outdated (they refer to the old trickling mechanism which was replaced with poisson-distributed batches a few major releases ago in Bitcoin Core). – Pieter Wuille – 2018-12-19T21:20:40.393