2 major findings · 1 minor finding · 1 suggestion
Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.
Findings
[major] · A failed order-position write leaves a half-initialized wallet transaction
If WriteOrderPosNext fails, AddToWallet retains the new mapWallet entry without its ordering or spend indexes, and subsequent retries do not repair them.
Location: src/wallet/wallet.cpp:1091 (head).
Details and suggested fix
The new return runs after mapWallet.emplace but before assigning nOrderPos, initializing m_it_wtxOrdered, calling AddToSpends, or writing the transaction. CommitTransaction throws without removing the entry, and RPC exception handling reports an error while leaving the wallet loaded. Once writes recover, re-adding the transaction takes the existing-entry Update path, which never constructs the missing indexes. An unchanged retry may write nothing; a metadata-changing retry can persist the TX record but still leaves the indexes broken. Removing this entry through removeprunedfunds, enabled with -deprecatedrpc=removeprunedfunds, passes its default-constructed iterator to wtxOrdered.erase, causing undefined behavior. With broadcasting enabled, normal rebroadcast can also later submit the retained unconfirmed transaction after the send RPC reported a commit failure. Base continued index initialization after the failed counter write. Erase the newly inserted entry and restore nOrderPosNext before returning, so recovery can retry normal initialization. This requires a local order-position write failure followed by continued wallet use; no production occurrence was identified.
[major] · A failed top-up descriptor write leaves generated scripts unregistered
After a range-extending descriptor write fails, retries skip registration of the generated scripts, so later issued addresses can remain unrecognized by the running wallet.
Location: src/wallet/scriptpubkeyman.cpp:1183 (head).
Details and suggested fix
When TopUp extends the range and cache-item writes succeed, TopUpWithDB has already changed its script/pubkey maps, descriptor cache, m_max_cached_index and range before WriteDescriptor. The new exception skips TopUpCallback. Batch destruction rolls back the database writes but not those memory changes. After storage recovers, retries start at the advanced cached index, so they neither register the skipped scripts in CWallet::m_cached_spks nor rewrite their rolled-back cache items. GetNewDestination can eventually return those addresses, while wallet-level IsMine returns false for their scripts and incoming payments can be missed. Reloading can restore recognition for ordinary descriptors, but already processed blocks need a rescan. For hardened-ranged (/*h) descriptors, persisting the extended range without the per-index cache entries can instead make the next load fail with "Unable to expand wallet descriptor from cache". Restore the maps, cache, index and range on failure so a retry derives, writes and registers the affected scripts again. Base still called the callback after this write failure; the analogous cache-item failure path is pre-existing. No production occurrence of this local storage-failure sequence was identified.
[minor] · A failed abandonment write prevents a retry from reaching descendants
If the parent's metadata write fails during abandontransaction, a later retry reports success without abandoning its descendants or persisting the parent's changed state.
Location: src/wallet/wallet.cpp:1416 (head).
Details and suggested fix
AbandonTransaction marks an eligible parent abandoned in memory before RecursiveUpdateTxState writes it. If WriteTxMetadata fails, the new exception exits before queuing descendants or calling MarkInputsDirty. The RPC reports an error, but the wallet retains the changed parent state. After writes recover, retrying returns UNCHANGED for that already-abandoned parent, so it skips persistence and traversal and reports success while descendant spends remain active. Base continued traversal after the failed write. Restore the previous state before throwing so the retry can perform the write and visit descendants. Reloading restores the parent's on-disk state and permits another abandonment attempt when eligible. This requires an authenticated abandonment request and a local metadata-write failure; no production occurrence was identified.
Optional improvements
[suggestion] · A best-block write failure prevents even attempting a backup
BackupWallet now refuses to attempt a copy after a locator-write failure, although the database may still be readable and backup to another filesystem may succeed.
Location: src/wallet/wallet.cpp:3199 (head).
Details and suggested fix
When an attempted WriteBestBlock update fails, the new return prevents GetDatabase().Backup from running; base attempted the copy regardless. SQLite's backup reads the source and writes a separate destination, so a source write failure, such as a full source filesystem, does not by itself establish that the copy must fail. This removes a useful recovery option from backupwallet and other backup callers precisely when storage is failing. Attempt the backup and log a warning about the stale locator rather than making its update a prerequisite. Restoring such a copy may require a rescan and access to the relevant historical blocks, but it can still preserve a readable wallet.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Report a failed version write as a load failure