<p>Bitcoin clients can have headers without having blocks. (However, Bitcoin Core never has a block without a header.)</p>

<hr>

<p>A <code>synced_blocks</code> of -1 means that the best block for the other node is unknown.</p>

<p><code>synced_blocks</code> is set here:</p>

<p><a href="https://github.com/bitcoin/bitcoin/blob/b3e42b6d02e8d19658a9135e427ebceab5367779/src/main.cpp#L557" rel="nofollow">https://github.com/bitcoin/bitcoin/blob/b3e42b6d02e8d19658a9135e427ebceab5367779/src/main.cpp#L557</a></p>

<pre><code>stats.nCommonHeight = state-&gt;pindexLastCommonBlock ? state-&gt;pindexLastCommonBlock-&gt;nHeight : -1;
</code></pre>

<hr>

<p>A <code>synced_headers</code> of -1 means that the best header for the other node is unknown.</p>

<p><code>synced_headers</code> is set here:</p>

<p><a href="https://github.com/bitcoin/bitcoin/blob/b3e42b6d02e8d19658a9135e427ebceab5367779/src/main.cpp#L556" rel="nofollow">https://github.com/bitcoin/bitcoin/blob/b3e42b6d02e8d19658a9135e427ebceab5367779/src/main.cpp#L556</a></p>

<pre><code>stats.nSyncHeight = state-&gt;pindexBestKnownBlock ? state-&gt;pindexBestKnownBlock-&gt;nHeight : -1;
</code></pre>

CC BY-SA 3.0
2016-05-17T12:56:13.617Z
Thanks again, Nick. So would it be correct to say that if the nCommonHeight is -1, then the other node isn't attempting to send or receive block data with our node?
inersha
CC BY-SA 3.0
2016-05-17T18:31:56.077Z
@inersha I think so, yeah.
Nick ODell
CC BY-SA 3.0
2016-05-17T04:24:57.157Z
2016-05-17T04:24:57.157Z
Nick ODell
<p>My P2P is a bit rusty, but as far as I understand; if we're running a full node, other nodes will connect to us to share blocks. So I can see why it would be useful to be able to see how far behind other nodes's blockchains are with the <code>getpeerinfo</code> command.</p>

<p>However, what's the practical difference between <code>synced_headers</code> and <code>synced_blocks</code>?</p>

<p>For example, what does it mean if a peer has <code>synced_headers</code> equal to the height of our own blockchain, but a <code>synced_blocks</code> of <strong>-1</strong>?</p>

<json-rpc><network><synchronization>
What's the difference between synced_blocks and synced_headers?
inersha
# What's the difference between synced_blocks and synced_headers?

(Asked by: username_0 on 2016-05-16)

My P2P is a bit rusty, but as far as I understand; if we're running a full node, other nodes will connect to us to share blocks. So I can see why it would be useful to be able to see how far behind other nodes's blockchains are with the `getpeerinfo` command.

However, what's the practical difference between `synced_headers` and `synced_blocks`?

For example, what does it mean if a peer has `synced_headers` equal to the height of our own blockchain, but a `synced_blocks` of **-1**?

**Tags:** json-rpc, network, synchronization


---

## 1 answers

### Answer by username_1 on 2016-05-17. Score: 2 | Accepted answer

Bitcoin clients can have headers without having blocks. (However, Bitcoin Core never has a block without a header.)

A synced_blocks of -1 means that the best block for the other node is unknown.
synced_blocks is set here:
https://github.com/bitcoin/bitcoin/blob/b3e42b6d02e8d19658a9135e427ebceab5367779/src/main.cpp#L557
stats.nCommonHeight = state->pindexLastCommonBlock ? state->pindexLastCommonBlock->nHeight : -1;


A synced_headers of -1 means that the best header for the other node is unknown.
synced_headers is set here:
https://github.com/bitcoin/bitcoin/blob/b3e42b6d02e8d19658a9135e427ebceab5367779/src/main.cpp#L556
stats.nSyncHeight = state->pindexBestKnownBlock ? state->pindexBestKnownBlock->nHeight : -1;

> **Comments:**
> **username_0**: Thanks again, Nick. So would it be correct to say that if the nCommonHeight is -1, then the other node isn't attempting to send or receive block data with our node?  
> **username_1**: @username_0 I think so, yeah.  

---

