1
I am reading the protocol part. One silly question. I found the part processing getblocks part, but i did not find when and where to send the getblocks command.Or it is deleted in the new bitcoin edition. Any idea, I will appreciate it very much.
1
I am reading the protocol part. One silly question. I found the part processing getblocks part, but i did not find when and where to send the getblocks command.Or it is deleted in the new bitcoin edition. Any idea, I will appreciate it very much.
3
You're correct: the Bitcoin Core master branch no longer sends the getblocks message because it uses headers-first synchronization to get all the headers (with the getheaders message), allowing it to hash the headers itself, verify their proof-of-work, and request the corresponding blocks in parallel from multiple peers with getdata messages. I believe the upcoming version 0.10 branch is supposed to be forked off of the master branch later today. (Will update answer with link when that happens.)
Here are some direct code links:
Bitcoin Core 0.9.3 sends the getblocks message with this line. That function is defined here.
In the master branch, this is the patch that replaced the line above
Bitcoin Core version 0.10 will continue to process the getblocks message from remote peers, as you note.
1I really appreciate your answer. Thank you very much, David. – Eleven – 2014-11-18T13:20:33.367
Hi David,one point confused me. Is it in parallel that requesting the corresponding blocks with getdata messages. I think it is in a single thread. We can get at most 16 blocks from one peer and then iterate another peer. Is it right? Thank you – Eleven – 2014-11-18T15:14:01.387
@Eleven The headers-first pull linked in the answer says, "Blocks are fetched in parallel from all available outbound peers, using a limited moving window. When one peer stalls the movement of the window, it is disconnected." I haven't reviewed that code yet, but if you find something that contradicts that statement, let me know and I'll update the answer. Thanks! – David A. Harding – 2014-11-18T15:39:36.510