1 major finding · 8 minor findings · 5 suggestions
Earlier concerns neither republished nor resolved: 1 minor finding · 1 suggestion. See the Run archive for their assessments.
Findings
[major] · GUI Restore and Migrate reports success without migrating
After a successful restore without loading, pointer-sensitive status checks skip migration and show "Migration Successful".
Location: src/wallet/interfaces.cpp:614 (head).
Details and suggested fix
With load_after_restore=false, RestoreWallet copies the backup but returns a successful result containing a null wallet. The adapter tests ResultPtr truthiness, which requires a non-null pointer, and replaces that success with util::Error{}. MigrateWalletActivity::restore_and_migrate, the interface's caller using this mode, then takes its failure branch instead of calling do_migrate(). Its error text is empty, so finish() displays the success dialog. The copied wallet remains unmigrated, and retrying with the same name fails because wallet.dat already exists; the original backup remains intact. Test has_value() in both this adapter and the GUI continuation so operation success remains distinct from whether a wallet was loaded.
[minor] · Successful migration rollback reports a backup restore failure
A failed migration that successfully restores its legacy backup still appends "Unable to restore backup of wallet." because the no-load result contains a null pointer.
Location: src/wallet/wallet.cpp:4452 (head).
Details and suggested fix
Rollback calls RestoreWallet with load_after_restore=false, so success does not produce a wallet pointer. if (!ptr_wallet) tests pointer presence rather than operation status and therefore reports restoration failure even after the copy succeeded. Base checked the separate restoration error instead. Check ptr_wallet.has_value() here and return the existing failed migration result after a successful restore. Do not merely fall through: the unconditional result.update(std::move(res)) below would replace that error state with success.
[minor] · Kernel logs the load result instead of the verification result
Kernel manager creation still fails on verification errors, but its failure log loses the explanation by formatting the successful loading result.
Location: src/kernel/bitcoinkernel.cpp:1292 (head).
Details and suggested fix
This branch runs only after loading succeeded without interruption, yet it formats util::ErrorString(load_result) instead of verify_result. The log therefore omits explanations such as a future-dated tip, a corrupted block database, or insufficient dbcache when full verification is required. Log ErrorString(verify_result) instead. Also handle interruption explicitly when formatting this diagnostic: verification now returns Interrupted{} without the "Block verification was interrupted" text that base supplied, so changing the variable alone does not restore that explanation.
[minor] · Empty failure markers leak into user-visible error text
Using util::Error{} only to select failure inserts empty message elements that become stray newlines and extra spaces in wallet diagnostics.
Location: src/util/result.h:437 (head).
Details and suggested fix
ResultTraits<Error>::construct pushes src.message even when it is empty. For a corrupt wallet, PopulateWalletFromDB inserts an empty error before the explanation, and LoadExisting appends another. Startup joins these elements with newlines, producing a leading and trailing newline. The loadwallet path adds its prefix and another empty marker, producing doubled and trailing spaces through ErrorString. Similarly, createfromdump appends an empty marker after a database failure, and the wallet tool prints it as a blank line. Skip empty messages in the Error trait while retaining its failure discriminator.
[minor] · bitcoin-wallet prints recoverable load warnings twice
For NONCRITICAL_ERROR and NEED_RESCAN, bitcoin-wallet prints the same warning through both ErrorString(populate) and the warning loop.
Location: src/wallet/wallettool.cpp:62 (head).
Details and suggested fix
PopulateWalletFromDB now selects failure for every status other than LOAD_OK, including the two recoverable statuses whose explanations are stored in warnings. The !populate branch prints ErrorString(populate), which already includes warnings. The following loop then prints those warnings again, with neither print adding a separator. The later guard still accepts these wallets, so the tool continues after emitting duplicated diagnostics. Print only the error collection in the first branch and leave the warning loop responsible for warnings.
[minor] · Restore exceptions skip cleanup of the created wallet directory
With load_after_restore=true, a copy exception now returns before cleanup and leaves a newly created wallet directory behind.
Location: src/wallet/wallet.cpp:463 (head).
Details and suggested fix
A restorewallet request using an existing directory as the backup source passes fs::exists. For a fresh wallet name, restoration creates the destination directory before fs::copy_file throws. The catch records the error but now returns immediately, bypassing the cleanup guarded by load_after_restore && !result. Base fell through and removed the empty directory it had created. Remove the catch's early return so the error reaches the existing flag-driven cleanup.
[minor] · Expected-to-Result conversion reads the error on success
Converting a successful Expected<int, int> to Result<int, int> aborts; no current caller of this adapter was identified, so production impact is unconfirmed.
Location: src/util/result.h:234 (head).
Details and suggested fix
In the successful if (e) branch, the constructor calls e.error() instead of reading the value. Expected::error() asserts that the error alternative is active, so the compatible int/int conversion aborts. Other type combinations can fail to instantiate, and converting to Result<void, E> supplies an argument that its success constructor rejects. Move e.value() in the non-void success branch and construct void success without an argument. Add successful and failed conversion tests, including void success.
[minor] · Cross-type conversion mistakes successful-null ResultPtr for failure
Cross-type conversion of a successful-null ResultPtr creates an error or asserts; no current production caller producing that input was identified.
Location: src/util/result.h:351 (head).
Details and suggested fix
Result(O&&) passes the source's actual type to move<false>. For a ResultPtr source, if (src) checks both operation success and pointer presence, so a successful null takes the error branch. With a void error type, that branch manufactures failure; with a non-void error type, it calls src.error() despite no error being active. The pointer tests explicitly support successful null results, but do not convert one across types. Use the source's base Result success discriminator in move() rather than its pointer-sensitive operator, and add a null-success conversion test.
[minor] · Closing an RPC-unloaded wallet can abort debug builds
A trusted RPC unload during the GUI's close-all confirmation can leave a stale model whose subsequent removal trips the new Assume in Debug builds.
Location: src/wallet/interfaces.cpp:507 (head).
Details and suggested fix
If unloadwallet removes a wallet while the "Close all wallets" dialog is open, the queued GUI unload handler defers deleting its model because a non-progress modal is active. Confirming the dialog can then make closeAllWallets call remove() on that stale model. RemoveWallet returns an error because the wallet is already absent from the context, and the new Assume aborts with ABORT_ON_FAILED_ASSUME. Base ignored this not-found result, and Release builds still tolerate it. This narrow timing window has not been reproduced. Preserve the tolerant behavior by discarding or logging the result instead of asserting it.
Optional improvements
[suggestion] · Failed reindex retry retains the previous attempt's error
If an approved reindex retry also fails, the final error includes the first attempt's already-presented diagnostic as well as the retry's diagnostic.
Location: src/init.cpp:1965 (head).
Details and suggested fix
Base replaced the status and error tuple when retrying. result.update() instead transfers the retry's messages into the existing result before updating its state. Consequently, a second failure reaches InitError(ErrorString(result)) with both attempts' errors, even though the first was already handled by the reindex prompt. Use a fresh result for the retry to preserve the previous replacement behavior. A successful retry does not take this error-reporting branch.
[suggestion] · Test setup no longer rejects interrupted chainstate loads
The fixture's new Result assertions accept interruption, unlike the previous assertions that required completed success.
Location: src/test/util/setup_common.cpp:375 (head).
Details and suggested fix
Interrupted is carried as a successful InterruptResult, so Assert(load_result) and Assert(verify_result) both accept it. The helper then marks the chainstate as loaded and proceeds to activation. Normal fixtures do not request interruption, but these assertions no longer enforce their previous completion invariant. Also assert !IsInterrupted(*load_result) and !IsInterrupted(*verify_result) after checking each result.
[suggestion] · Unused result local in createTransaction
The newly added util::Result<CTransactionRef> local is unrelated to the result returned by WalletImpl::createTransaction.
Location: src/wallet/interfaces.cpp:275 (head).
Details and suggested fix
The function never reads or populates this local. It takes the wallet lock and returns CreateTransaction(...) directly, so the local neither carries messages nor participates in the return value. Remove the declaration while keeping the lock and direct return.
[suggestion] · JoinMessages copies both input vectors
The initializer list copies both message vectors and their strings before joining them, adding avoidable work to diagnostic formatting.
Location: src/util/messages.cpp:16 (head).
Details and suggested fix
{messages.errors, messages.warnings} constructs an initializer list of std::vector<bilingual_str> values copied from the members. The loop's const auto& only avoids copying those temporary vectors again. Iterate over pointers to the two members and dereference each collection in the inner loop. That preserves the current order and separator behavior without the vector and string copies.
[suggestion] · Conversion test deletes Derived through a non-virtual base
The new derived_to_base test transfers a Derived allocation into unique_ptr<NoCopyNoMove>, whose default deleter uses a base without a virtual destructor.
Location: src/test/result_tests.cpp:288 (head).
Details and suggested fix
DerivedToBaseFn converts ownership to unique_ptr<NoCopyNoMove>, so both the temporary result in the first assertion and the later base variable delete a Derived through default_delete<NoCopyNoMove>. That is formally undefined behavior. The current types have matching sizes and trivial destructors, so this does not establish an observed test failure. Use a separate test hierarchy with a virtual base destructor to keep the ownership-conversion assertions well-defined.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [minor]: Result may destroy an unconstructed success value
- [suggestion]: Scope the GCC 12 warning exception to the false-positive site