rpc: report background validation progress in getchainstates #36220

pull arejula27 wants to merge 2 commits into bitcoin:master from arejula27:rpc-getchainstates-background-progress changing 2 files +7 −2
  1. arejula27 commented at 3:05 PM on September 10, 2026: contributor

    After #33259, getblockchaininfo reports the progress of the background chainstate relative to the snapshot base block, but getchainstates still computes verificationprogress against the network tip for every chainstate, so the same node reports two different numbers for the same chainstate.

    This PR modifies verificationprogress value to report the correct value, relative to the block the chainstate actually stops at.

  2. rpc: report background validation progress in getchainstates 2e2deb8262
  3. DrahtBot added the label RPC/REST/ZMQ on Sep 10, 2026
  4. DrahtBot commented at 3:05 PM on September 10, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36220.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK nervana21
    Concept ACK sedited, vicjuma

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. test: check background validation progress in getchainstates d9638e49f6
  6. sedited commented at 3:35 PM on September 10, 2026: contributor

    Concept ACK

  7. arejula27 commented at 4:06 PM on September 10, 2026: contributor

    would be interesting to add a new field "targetBlock" to show until which block must validate the background chainstate?

  8. in src/rpc/blockchain.cpp:3614 in d9638e49f6
    3610 | @@ -3641,7 +3611,8 @@ return RPCMethod{
    3611 |          data.pushKV("bits", strprintf("%08x", tip->nBits));
    3612 |          data.pushKV("target", GetTarget(*tip, chainman.GetConsensus().powLimit).GetHex());
    3613 |          data.pushKV("difficulty", GetDifficulty(*tip));
    3614 | -        data.pushKV("verificationprogress", chainman.GuessVerificationProgress(tip));
    3615 | +        data.pushKV("verificationprogress", cs.TargetBlock() ? chainman.GetBackgroundVerificationProgress(*tip)
    


    vicjuma commented at 5:59 PM on September 10, 2026:

    I feel like this change better aligns the assumeutxo.md documentation (accurate monitoring)

    After the snapshot has loaded, the syncing process of both the snapshot chain and the background IBD chain can be monitored with the getchainstates RPC.


    nervana21 commented at 1:02 PM on September 11, 2026:

    2e2deb8262f2297af61b152aa7646e3cabcc4f40: rpc: report background validation progress in getchainstates

            data.pushKV("verificationprogress", cs.TargetBlock().has_value() ? chainman.GetBackgroundVerificationProgress(*tip)
    

    nit


    arejula27 commented at 5:29 PM on September 11, 2026:

    Thanks for the review! TargetBlock() returns a const CBlockIndex* rather than a std::optional, so I don't think .has_value() would work here.


    nervana21 commented at 5:36 PM on September 11, 2026:

    ahh, you're right. my mistake!

  9. vicjuma commented at 5:59 PM on September 10, 2026: contributor

    Concept ACK

  10. nervana21 commented at 10:47 PM on September 10, 2026: contributor

    Concept ACK

  11. nervana21 commented at 1:03 PM on September 11, 2026: contributor

    tACK d9638e49f6a7ef70dbe31cb85e809d9f81e3ce55

  12. DrahtBot requested review from sedited on Sep 11, 2026
  13. DrahtBot requested review from vicjuma on Sep 11, 2026
  14. DrahtBot added the label CI failed on Sep 18, 2026
  15. maflcko removed the label CI failed on Sep 18, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-01 18:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me