mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
rpc: report background validation progress in getchainstates #36220
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36220
Loading…
Reference in a new issue
No description provided.
Delete branch "rpc-getchainstates-background-progress"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After #33259,
getblockchaininforeports the progress of the background chainstate relative to the snapshot base block, butgetchainstatesstill computesverificationprogressagainst the network tip for every chainstate, so the same node reports two different numbers for the same chainstate.This PR modifies
verificationprogressvalue to report the correct value, relative to the block the chainstate actually stops at.The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Concept ACK
would be interesting to add a new field "targetBlock" to show until which block must validate the background chainstate?
Concept ACK
I feel like this change better aligns the assumeutxo.md documentation (accurate monitoring)
Concept ACK
2e2deb8262: rpc: report background validation progress in getchainstatesnit
tACK
d9638e49f6Thanks for the review!
TargetBlock()returns aconst CBlockIndex*rather than astd::optional, so I don't think.has_value()would work here.ahh, you're right. my mistake!
Concept ACK
I’m currently running a node with AssumeUTXO, so I checked this before and after applying the change. My snapshot base is at height 935000.
Before the fix, at background height 474828, the background chainstate’s
verificationprogressingetchainstatesreported 16.73%, whilebackgroundvalidation.verificationprogressingetblockchaininforeported 18.22% for the same block. After the fix, at height 475948, both reported exactly 0.1834620809971763. This is a good improvement:getchainstatesnow reports background progress toward the snapshot base, asgetblockchaininfoalready does.Locally, the full functional test passed. Reverting only the RPC fix made the background-progress assertion fail; restoring it made the full test pass again.
Optional suggestion: could we also check the active chainstate’s
verificationprogressagainst the top-level value fromgetblockchaininfo? Both chainstates are already available in the test, so this would also check that active-chainstate progress is still reported correctly.Base:
aa76bd266df9742a266d52e0e5da8dbf033658f6Head:
d9638e49f6a7ef70dbe31cb85e809d9f81e3ce55Previously reported concerns remain unresolved: 1 minor.
Previous findings
[Minor · still present] Provide a compatibility path for the changed progress meaning
This changes the existing getchainstates.verificationprogress meaning for a historical chainstate from progress toward the network tip to progress toward the snapshot target. The previous help text documented the network-tip meaning, and doc/developer-notes.md treats logical-meaning changes as potentially backward-incompatible, recommending a -deprecatedrpc compatibility path and release note. Please preserve the old result during a migration period or establish why this field’s prior meaning is not a compatibility contract. No specific downstream consumer relying on the old value was identified in the checkout, so production client impact is unconfirmed.
Location:
src/rpc/blockchain.cpp:3614(head).First reported at
d9638e49f6a7ef70dbe31cb85e809d9f81e3ce55. Last checked atd9638e49f6a7ef70dbe31cb85e809d9f81e3ce55.Review coverage was incomplete.
Review limitations
Review tier: standard
Full review report
I understand this fixes an existing reporting inconsistency, but I’d prefer us to revisit the underlying synchronization design and costs discussed in #36476, rather than keep adding special cases around background validation. I think we should discuss that broader direction before extending this approach further.
Concept NACK on the direction of endless patches for a broken feature.