1

In When and how does bitcoin node sync itself? it is described that there are a number of ways for nodes to synchronize on the blockchain state.

How does (legacy) INV mechanism works?

1

If I understood correctly it goes like this:

  1. I get the announcement from a peer that he found a new tip in his blockchain. (so called INV message)

  2. I send him the block locator message with last 10 hashes from the tip of my blockchain.

  3. Me and him could be on different branches so he has to detect which hash do we have in common (the hash where fork happened). Or we are on the same branch and he just advanced the branch by one hash. NOTE: If he does not find the common hash he will ask me to send hashes further back my chain (fork happened somewhere earlier).

  4. When he detects the common hash, he will send me the headers from this hash up to the newly found hash. I validate each header, stopping if a header in this process is invalid.

  5. If his chain is now longer than mine (edit: and download the transaction part's of his blocks, verify them then) I switch to new chain.

  • The headers messages do not work this way. – Anonymous Oct 23 '17 at 22:32
  • Feel free to copy my answer and change what is wrong. – croraf Oct 23 '17 at 23:00
  • @eponymous what is the wrong part of the answer? – croraf Oct 28 '17 at 9:49
  • @eponymous In what way is it wrong? – Pieter Wuille Oct 28 '17 at 11:38

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.