feat(fullnode): auto-reconcile wallet after bootstrap; runtime rescan for pruned nodes
A wallet bootstrapped from a snapshot keeps its wallet.dat but never rescans, so its spent-state is stale and the first send tries to spend already-spent notes and is rejected. The startup -rescan flag can't fix it either: the snapshot lacks the pre-snapshot block history -rescan needs, so it errors. The working fix is a runtime rescanblockchain RPC from a height the snapshot actually has. - Add App::runtimeRescan(startHeight): runs rescanblockchain via the worker, drives the rescanning UI state, and owns completion via the RPC callback (getrescaninfo is unavailable on this daemon). Suppresses the per-second mining/rescan pollers and the Core/balance/tx refreshes while the daemon holds cs_main for the scan. - Add App::detectLowestAvailableBlockHeight(): async binary search via getblock for the lowest height whose block data is on disk → the snapshot base, and whether the node still has full history. - Auto-reconcile after bootstrap: both completion sites (wizard + Settings download dialog) mark a pending rescan; once the daemon is back up and the tip is known, detect the base and runtimeRescan() from it (or -rescan restart on a full node). - Settings "Rescan Blockchain" now probes first: full-history nodes get the existing -rescan restart; bootstrapped/pruned nodes get a prompt pre-filled with the detected base height that runs the runtime rescan. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -774,6 +774,8 @@ void App::renderFirstRunWizard() {
|
||||
auto finalProg = bootstrap_->getProgress();
|
||||
if (finalProg.state == util::Bootstrap::State::Completed) {
|
||||
bootstrap_.reset();
|
||||
// Reconcile the preserved wallet.dat against the new chain once the daemon is up.
|
||||
markPostBootstrapRescanPending();
|
||||
wizard_phase_ = WizardPhase::EncryptOffer;
|
||||
} else {
|
||||
wizard_phase_ = WizardPhase::BootstrapFailed;
|
||||
|
||||
Reference in New Issue
Block a user