#29109 (comment) reports that a wallet with noncritical errors cannot be dumped with bitcoin-wallet dump
. This was caused by an erroneous reset of the wallet pointer when the loading the wallet returns something other than LOAD_OK
. Not all errors are errors that require aborting, so unilaterally resetting the pointer at that time is incorrect. The first commit resolves this issue.
Furthermore, if a wallet has loading errors, that should not prevent the wallet tool from dumping the wallet. The wallet application logic should not get in the way of performing such a low level database operation, especially when it’s primary usage is for debugging potentially corrupted wallets. The 2nd commit is taken from #28710 and changes the dump
to stop at making a WalletDatabase
rather than making a CWallet
only to retrieve the underlying WalletDatabase
.