<p>They don't, actually.</p>
<p>The protocol for finding the best headers chain is fairly simple: a single peer is asked for the 2000 headers following the last known block header the node knows it and the peer have in common. When these headers arrive, it is asked for more. This process repeats until either a timeout is hit, or a point in time close to the present is reached. When the latter occurs, <em>all</em> peers are asked for their headers.</p>
<p>Of course, simultaneously, peers (all of them) are asked for actual blocks too, whenever they claim to have blocks for headers which we believe could be on the path towards the best chain. If peers fail to deliver these, they get disconnected. If they provide invalid blocks, they may become marked as &quot;discouraged&quot; (replacable), and if applicable, the block may get marked as permanently invalid too. If that happens, peers that provide other blocks or headers that descend from the invalid block will get punished too.</p>
<p>There exist some ideas about <a href="https://en.bitcoin.it/wiki/User:Gmaxwell/Reverse_header-fetching_sync" rel="nofollow noreferrer">reverse headers syncing</a> that's probably closer to what you suggest. This is not implemented anywhere, as far as I know.</p>

CC BY-SA 4.0
2021-05-31T03:47:11.727Z
2021-05-31T03:47:11.727Z
Pieter Wuille
<p>If yes, is this how a node decides that the peer has the best chain for headers-first download?</p>

<synchronization><block-header><peers>
Do peers advertise their chain work?
paulo
# Do peers advertise their chain work?

(Asked by: username_0 on 2021-05-24)

If yes, is this how a node decides that the peer has the best chain for headers-first download?

**Tags:** synchronization, block-header, peers


---

## 1 answers

### Answer by username_1 on 2021-05-31. Score: 1

They don't, actually.

The protocol for finding the best headers chain is fairly simple: a single peer is asked for the 2000 headers following the last known block header the node knows it and the peer have in common. When these headers arrive, it is asked for more. This process repeats until either a timeout is hit, or a point in time close to the present is reached. When the latter occurs, *all* peers are asked for their headers.

Of course, simultaneously, peers (all of them) are asked for actual blocks too, whenever they claim to have blocks for headers which we believe could be on the path towards the best chain. If peers fail to deliver these, they get disconnected. If they provide invalid blocks, they may become marked as "discouraged" (replacable), and if applicable, the block may get marked as permanently invalid too. If that happens, peers that provide other blocks or headers that descend from the invalid block will get punished too.

There exist some ideas about [reverse headers syncing](https://en.bitcoin.it/wiki/User:Gmaxwell/Reverse_header-fetching_sync) that's probably closer to what you suggest. This is not implemented anywhere, as far as I know.


---

