You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Review finding: a failed commit in a background top-up aborts the process #319
A failed commit in a background top-up aborts the process from the scheduler thread.
Severity: low. Found in the 2026-11-04 review of the v1.0.1 change set (all 1.x.x merges since v1.0.0 plus the open PRs that target it), against 1.x.x21fee6ee8e; area: #144.
Observed
Confidence: confirmed from code (the exception propagates to std::terminate); the trigger needs a COMMIT failure.
Location:src/wallet/scriptpubkeyman.cpp:1305-1313 (the self-committing top-up throws std::runtime_error after a failed TxnCommit, even when TxnAbort and the in-memory rollback succeeded); callers RunScheduledPendingInitialKeyPoolTopUp and RunScheduledP2MRKeyPoolRefill (src/wallet/wallet.cpp:378-487) do not catch; CScheduler::serviceQueue rethrows and util::TraceThread rethrows, so the process calls std::terminate (src/scheduler.cpp, src/util/thread.cpp:16-28), at 21fee6e.
Scenario: the disk fills, or the database hits an I/O error at COMMIT, during a deferred or low-watermark refill. That can happen up to about 60 s of SLH-DSA derivation after wallet creation or unlock. qbitd or qbit-qt then aborts. Since wallet: publish descriptor top-ups after commit #144 the memory state, the publication and the transaction are already rolled back when the exception is thrown. The throw is therefore not needed for consistency in the aborted == true case, and MaybeTopUpInternalP2MRKeyPool already catches the same exception for the inline path.
Evidence: code read, not run.
Impact
This is a crash on a recoverable storage error in background work the user did not start. It is pre-existing: v1.0.0 also threw on commit failure, and Bitcoin Core does so on its blockConnected -> MarkUnusedAddresses path. It is reported because the deferred and low-watermark refills are qbit-specific scheduler paths that run for much longer.
Suggested fix
When the abort after a failed commit succeeded, return util::Error instead of throwing, which the background steps already handle as FAILED and "paused". Keep the throw only when TxnAbort fails. Alternatively, catch std::exception in the two RunScheduled* functions, log it, and clear the scheduled flags.
Fixed on 1.x.x by #299 (merged as dd86425), which reports a rolled-back top-up commit failure as an error that pauses the background refill, instead of throwing from the scheduler and aborting the process. main gets the fix when 1.x.x is integrated.
Activity
wallet: report a rolled-back top-up commit failure instead of throwing
wallet: deferred P2MR keypool refill at startup and unlock; Lock() wa…
kiwidream commentedon Nov 5, 2026
Fixed on
1.x.xby #299 (merged as dd86425), which reports a rolled-back top-up commit failure as an error that pauses the background refill, instead of throwing from the scheduler and aborting the process.maingets the fix when1.x.xis integrated.doc: update the v1.0.1 release notes for the changes merged since 202…
doc: update the v1.0.1 release notes for the changes merged since 202…
doc: update the v1.0.1 release notes for the changes merged since 202…
release: prepare v1.0.1 (#181)
wallet: deferred P2MR keypool refill at startup and unlock; Lock() wa…
release: prepare v1.0.1 (#181)