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.


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 version 0.10 will continue to process the getblocks message from remote peers, as you note.

  • 1
    I really appreciate your answer. Thank you very much, David. – Eleven Nov 18 '14 at 13:20
  • 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 Nov 18 '14 at 15:14
  • @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 Nov 18 '14 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.