Repository navigation
refactor(platform-wallet): read the current masternode list from dash-spv - #6032
Draft
Claudius-Maginificent wants to merge 7 commits into
Draft
Claudius-Maginificent wants to merge 7 commits into
Claudius-Maginificent wants to merge 7 commits into
Conversation
…-spv `SpvRuntime::current_masternode_list` and the crate's current summaries and entries read `DashSpvClient::current_masternode_list`, which returns the list only while header and masternode sync follow the chain. One client call replaces the readiness check, the separate list read and the run-session guard around them, so `while_following_the_chain` goes. A list dash-spv refuses is `PlatformWalletError::MasternodeListUnavailable`, as before. `live_provider_key_candidates_blocking` reads the gated blocking twin, so a list restored from disk while sync catches up no longer reports a key in use as unused. `is_ready` keeps its progress check: the quorum context provider calls it on every lookup, and dash-spv offers no current-list check that does not copy the whole list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Only the readiness-gated wrapper read it; the current entries read dash-spv's current list directly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…atches up The gated reads and the provider key candidates must refuse a list the engine already holds while sync catches up; the existing tests use fresh storage, where the ungated read also has no list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…m dash-spv `is_synced_to_tip` uses dash-spv's `MASTERNODE_LIST_TIP_TOLERANCE` instead of its own copy. `is_ready` documents that it is a cheap progress check without dash-spv's tip-age rule, so after the host sleeps it can report ready while `current_masternode_list` refuses the list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t only `masternode_key_reference_blocking`, behind the FFI key verification, read the ungated list, so a list restored from disk while sync catches up could vouch for a key the node no longer uses. It reads the gated blocking list like `fetch_masternode_key_reference`; the wallet and tracked records still fill in. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The list is refused while it does not follow the chain: still syncing, a stale header tip, or a list behind the tip. The error clears once sync catches up. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e test The public read's assertion joins the gated-reads test for a runtime that is not running. The restored-list test takes its imports from the module top. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Collaborator
|
🕓 Review not started yet because this PR is a draft.
Commit 0886d0c. Normal review starts when eligible; priority review starts as soon as a slot is available. |
6 of 13 tasks
lklimek
changed the base branch from
chore/mn-dashcore-k1-s1
to
feat/mn-provider-key-lookup
November 24, 2026 11:14
lklimek
force-pushed
the
refactor/mn-current-list-dash-spv
branch
from
November 24, 2026 11:15
a6416e1 to
0886d0c
Compare
This branch has not been deployed
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.
TL;DR: platform-wallet now reads the masternode list only through dash-spv's own "current list" check, so a list restored from disk while the client catches up can no longer make a key in use look unused or vouch for a key the node no longer uses.
User story
As a wallet app developer, I want every current-masternode-list read in platform-wallet to refuse a list that does not follow the chain, to achieve key checks and "unused key" answers that are never based on an outdated list.
Scenario
Base flow
A wallet app restarts with a masternode list stored on disk and, while SPV is still catching up, asks platform-wallet for unused provider key candidates or verifies a masternode key.
Actual behavior
platform-wallet checks readiness and then reads the list in a separate step, so the list can change between the two. Some readers (the blocking key-candidate and key-reference reads) are not gated at all and use the restored list: a key in use can be reported as unused, and an old list can vouch for a key the node has replaced.
Expected behavior
Each current-list read is a single dash-spv call that returns the list only while header and masternode sync follow the chain. While SPV catches up, has a stale header tip, or holds a list behind the tip, the read fails with
MasternodeListUnavailable, which clears once sync catches up.Detailed discussion
Issue being fixed or feature implemented
Stacked atop #6030 (
chore/mn-dashcore-k1-s1), which pins rust-dashcore with dash-spv'sDashSpvClient::current_masternode_list(dashpay/rust-dashcore#1466). A sibling of #6031, not stacked on it.What was done?
spv/runtime.rs:SpvRuntime::current_masternode_listand the crate's current summaries and entries reads callDashSpvClient::current_masternode_listthrough one helper. One client call replaces the readiness check, the separate list read and the run-session guard around them, sowhile_following_the_chainis removed. A list dash-spv refuses (MasternodeListNotCurrentError) becomesPlatformWalletError::MasternodeListUnavailable, as before; the reason is logged atdebug.current_masternode_list_summaries_blocking, the gated blocking twin:live_provider_key_candidates_blocking(masternode/key_candidates.rs) reads it, so a list restored from disk while sync catches up no longer reports a key in use as unused;masternode_key_reference_blocking(masternode/mod.rs, behind the FFI key verification) reads it, like the asyncfetch_masternode_key_reference. When the list is refused, the wallet and tracked records still fill in.masternode_list_entriesread is removed; only the readiness-gated wrapper used it.is_synced_to_tipuses dash-spv'sMASTERNODE_LIST_TIP_TOLERANCEinstead of its own copy.MasternodeListUnavailableand the FFI locator and update-registrar docs say the list is refused while it does not follow the chain (still syncing, a stale header tip, or a list behind the tip) and that the error clears once sync catches up.FFI / mobile behaviour changes
ErrorMasternodeListUnavailableduring catch-up, including when a list was restored from disk, instead of answering from that list.Known limitations
is_readystays a cheap progress check onMASTERNODE_LIST_TIP_TOLERANCE, without dash-spv's tip-age rule: the quorum context provider calls it on every lookup, and dash-spv offers no current-list check that does not copy the whole list. After the host sleeps it can report ready whilecurrent_masternode_listrefuses the list. ATODOwaits for a non-cloning dash-spv check.Follow-ups
masternode_list_summaries[_blocking],masternodes_by_voting_key_blocking,masternode_validity_snapshot_blocking,track_blocking.How Has This Been Tested?
spv/runtime.rs: no current list through any read while the runtime is not running; no current list while sync catches up; a list restored from disk is refused while sync catches up, by the gated reads and the provider key candidates; tip-tolerance boundary tests on dash-spv's constant.Breaking Changes
No Rust signature changes. The FFI behaviour changes above apply to mobile hosts.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
https://claude.ai/code/session_01WunYYk4eUkHuGstPtj83j4
🤖 Co-authored by Claudius the Magnificent AI Agent