fix(rpc): make verificationprogress tip-aware#1055
Open
Micah-Shallom wants to merge 5 commits into
Open
Conversation
Replace the validated/height formula (which sticks at 1.0 when the chain store stalls) with a time-based estimate using wall clock and block timestamps as external references the daemon cannot fudge. When validated freezes, `now` keeps advancing, the denominator grows, and progress visibly falls instead of falsely reporting fully synced. Adds 7 unit tests on the new helper.
Floresta computes time-based progress; bitcoind computes tx-weighted. Both converge at endpoints but drift mid-sync and at the tip (block timestamps lag `now` by seconds). Apply the same tolerance pattern already used for `difficulty`.
d80bdc9 to
1243566
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
validated / height(which sticks at 1.0 when the chain store stalls) with a time-based formula using wall clock and block timestamps as external references the daemon cannot fudge.When validated freezes for any reason,
nowkeeps advancing, the denominator grows, and progress visibly falls instead of falsely reporting fully synced.Why time-based instead of tx-weighted
Bitcoin Core's formula uses per-block cumulative tx counts and a baked-in
ChainTxDatacheckpoint. Both require a chainstore schema migration, which is out of scope for an RPC bugfix. Time-based progress uses two external references Floresta already has (wall clock + block timestamps) and resolves the bug as filed.Formula
Two external references (
nowfrom the OS clock,validated_block_timefrom the block header) anchor the ratio outside daemon state, so a stalled chain store can't push the value to 1.0.Test plan
cargo test -p floresta-node --libstacked on #948
Partial fix for #1015.