3

I read the bitcoin docs describing how btc syncs. During IBD it gets the inventories up to the tip with getblock. Why does it not skip this step and get the blocks, generating the inventories as it gets each block? Surely getting inventories is slow, unneeded and inefficient? I believe bitcoin daemon over version 0.10.0 now sync headers rather than inventories, i am talking about pre 0.10.0.

  • Your question contains too many misconceptions for me to answer... what do you mean by "skipping this step"? Syncing inventories exactly how the nodes learns about and downloads the blocks. I don't know what is slow, unneeded, or inefficient about it. – Pieter Wuille Mar 8 at 23:56
  • @Wuille why would I need to download inventory’s to learn about the blocks? What does a number and a hash tell me that I can’t get from syncing the block data it’s self. Perhaps I have misunderstood the docs? – Leo Cornelius Mar 9 at 5:49
  • The inventory is how you learn the block exists at all. It's how you figure out "oh this peer knows a block I don't have yet, let me ask for it". – Pieter Wuille Mar 9 at 5:59
  • @pieter wuille ah I see. I was under the perception your node already knew this. Thanks :) this has answered the question. Feel free to put it into a response and I will mark it as correct! – Leo Cornelius – Leo Cornelius Mar 9 at 6:58
  • Bitcoin 0.1 didn’t even have inventory messages. You mean 0.10. – Anonymous Mar 9 at 9:04
1

Pre 0.10 versions synced inventories as it was the way they composed a list of blocks that they then recursively request from the peer. It provides multiple benefits over just asking for all blocks since timestamp x (where is the timestamp of the last block we had).

The biggest one being that it allows you to check the peer is on the same chain as the checkpoint you are using, this means you can check the peer is on the correct chain (eg the one your checkpoints state is correct) before downloading blocks, which are considerably larger than just hashes.

| improve this answer | |

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.