0

Is there a way to know from bitcoind RPC if it's syncing headers or blocks? And is there a way to know the header sync progress?

Even if not directly available, is it possible to derive header sync progress from other information through RPC?

I tried to get this information from the debug log, but the problem there is that occasionally, the last header sync log message looks like this

Synchronizing blockheaders, height: 1660930 (~95.02%)

It never logs out whether it reached 100% or not, and that's a problem for the software that I'm working on.

2

The getblockchaininfo RPC will tell you have many blocks and headers you have. When the number of headers is larger, you're still synchronizing.

  • I'm not asking about whether bitcoind is syncing blocks or not. I'm talking about the header-first sync. I want to know the progress of that. – M.K. Safi Jan 14 at 23:40
  • 1
    Oh, I misread. In that case the answer is even easier: you can't know. – Pieter Wuille Jan 15 at 0:27
  • Pieter, what about comparing startingheight from the getpeerinfo response with the header field from the getblockchaininfo response? – M.K. Safi Jan 28 at 18:44
  • 1
    If an approximate answer is enough, you can just look at the timestamp of the last header. That's more accurate than relying on startingheight (which will be outdated for long lived connections). – Pieter Wuille Jan 28 at 19:20
  • 1
    The point I'm trying to make is that there is no exact answer to this question: your node is always syncing headers, and is never "done". There may be a block that was just mined, but you haven't learned about, so you can never be sure you're caught up. – Pieter Wuille Jan 28 at 19:22

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.