<p>If I understood correctly it goes like this:</p>

<ol>
<li><p>I get the announcement from a peer that he found a new tip in his blockchain. (so called <em>INV message</em>)</p></li>
<li><p>I send him the <em>block locator</em> message with last 10 hashes from the tip of my blockchain. </p></li>
<li><p>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).</p></li>
<li><p>When he detects the common hash, he will send me the headers from this hash <strong>up to</strong> the newly found hash. I validate each header, stopping if a header in this process is invalid.</p></li>
<li><p>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.</p></li>
</ol>

CC BY-SA 3.0
2017-10-23T22:32:56.503Z
The headers messages do not work this way.
Claris
CC BY-SA 3.0
2017-10-23T23:00:07.323Z
Feel free to copy my answer and change what is wrong.
croraf
CC BY-SA 3.0
2017-10-28T09:49:42.627Z
@eponymous what is the wrong part of the answer?
croraf
CC BY-SA 3.0
2017-10-28T11:38:49.347Z
@eponymous In what way is it wrong?
Pieter Wuille
CC BY-SA 3.0
2017-10-23T14:54:01.327Z
2017-10-28T09:41:34.100Z
2017-10-28T09:41:34.100Z
croraf
<p>In <a href="https://bitcoin.stackexchange.com/questions/61136/when-does-bitcoin-node-sync-itself/61139#61139">When and how does bitcoin node sync itself?</a> it is described that there are a number of ways for nodes to synchronize on the blockchain state.</p>

<p>How does (legacy) INV mechanism works?</p>

<blockchain><bitcoin-core><synchronization>
How do bitcoin nodes sync with the INV mechanism?
croraf
# How do bitcoin nodes sync with the INV mechanism?

(Asked by: username_0 on 2017-10-23)

In [When and how does bitcoin node sync itself?](https://bitcoin.stackexchange.com/questions/61136/when-does-bitcoin-node-sync-itself/61139#61139) it is described that there are a number of ways for nodes to synchronize on the blockchain state.

How does (legacy) INV mechanism works?

**Tags:** blockchain, bitcoin-core, synchronization


---

## 1 answers

### Answer by username_0 on 2017-10-23. Score: 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.

> **Comments:**
> **username_1**: The headers messages do not work this way.  
> **username_0**: Feel free to copy my answer and change what is wrong.  
> **username_0**: @eponymous what is the wrong part of the answer?  
> **username_2**: @eponymous In what way is it wrong?  

---

