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.

1 Answer 1

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.

7
  • 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, 2020 at 23:40
  • 1
    Oh, I misread. In that case the answer is even easier: you can't know. Jan 15, 2020 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, 2020 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). Jan 28, 2020 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. Jan 28, 2020 at 19:22

Your Answer

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

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