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

1 Answer 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 that's probably closer to what you suggest. This is not implemented anywhere, as far as I know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.