Skip to content

wallet: bitcoind fails to auto-load a non-empty external-signer wallet #21919

@hebasto

Description

@hebasto

When a non-empty wallet with the WALLET_FLAG_EXTERNAL_SIGNER flag is supposed to be auto-loaded, i.e., it is mentioned in the settings.json file, and binaries are built with the --disable-external-signer configure option, the bitcoind fails:

...
2021-05-11T12:07:20Z [init] Using SQLite Version 3.31.1
2021-05-11T12:07:20Z [init] Using wallet /home/hebasto/.bitcoin/testnet3/wallets/coldcard_t
2021-05-11T12:07:20Z [init] init message: Loading wallet…
2021-05-11T12:07:20Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:07:20Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:07:20Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:07:20Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:07:20Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:07:20Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:07:20Z [init] [coldcard_t] Setting spkMan to active: id = c2fe2eddfccf102a74da940e282062adc8c13fbd28d00477644d3fcd1f6efe5d, type = 0, internal = 0
2021-05-11T12:07:20Z [init] [coldcard_t] Releasing wallet
2021-05-11T12:07:20Z [init] 

************************
EXCEPTION: St12out_of_range       
map::at       
bitcoin in AppInit()       



************************
EXCEPTION: St12out_of_range       
map::at       
bitcoin in AppInit()       

2021-05-11T12:07:20Z [init] Shutdown: In progress...
2021-05-11T12:07:20Z [scheduler] scheduler thread exit
2021-05-11T12:07:21Z [shutoff] FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
2021-05-11T12:07:21Z [shutoff] FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.00s)
2021-05-11T12:07:21Z [shutoff] FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
2021-05-11T12:07:21Z [shutoff] FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.00s)
2021-05-11T12:07:21Z [shutoff] [w20191120] Releasing wallet
2021-05-11T12:07:21Z [shutoff] [watch-only] Releasing wallet
2021-05-11T12:07:21Z [shutoff] [default wallet] Releasing wallet
2021-05-11T12:07:21Z [shutoff] Shutdown: done

The reason is the CWallet::Create throws an exception that is not caught in

bitcoin/src/wallet/load.cpp

Lines 117 to 120 in e175a20

} catch (const std::runtime_error& e) {
chain.initError(Untranslated(e.what()));
return false;
}

With the following diff

--- a/src/wallet/load.cpp
+++ b/src/wallet/load.cpp
@@ -117,6 +117,9 @@ bool LoadWallets(interfaces::Chain& chain)
     } catch (const std::runtime_error& e) {
         chain.initError(Untranslated(e.what()));
         return false;
+    } catch (const std::exception& e) {
+        chain.initError(Untranslated(e.what()));
+        return false;
     }
 }
 

the bitcoind output is:

...
2021-05-11T12:18:21Z [init] Using SQLite Version 3.31.1
2021-05-11T12:18:21Z [init] Using wallet /home/hebasto/.bitcoin/testnet3/wallets/coldcard_t
2021-05-11T12:18:21Z [init] init message: Loading wallet…
2021-05-11T12:18:21Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:18:21Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:18:21Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:18:21Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:18:21Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:18:21Z [init] [coldcard_t] LoadDescriptorScriptPubKeyMan: Compiled without external signing support (required for external signing)
2021-05-11T12:18:21Z [init] [coldcard_t] Setting spkMan to active: id = c2fe2eddfccf102a74da940e282062adc8c13fbd28d00477644d3fcd1f6efe5d, type = 0, internal = 0
2021-05-11T12:18:21Z [init] [coldcard_t] Releasing wallet
2021-05-11T12:18:21Z [init] Error: map::at
Error: map::at
2021-05-11T12:18:21Z [init] Shutdown: In progress...
2021-05-11T12:18:22Z [scheduler] scheduler thread exit
2021-05-11T12:18:22Z [shutoff] FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
2021-05-11T12:18:22Z [shutoff] FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.00s)
2021-05-11T12:18:22Z [shutoff] FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
2021-05-11T12:18:22Z [shutoff] FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.00s)
2021-05-11T12:18:23Z [shutoff] [w20191120] Releasing wallet
2021-05-11T12:18:23Z [shutoff] [watch-only] Releasing wallet
2021-05-11T12:18:23Z [shutoff] [default wallet] Releasing wallet
2021-05-11T12:18:23Z [shutoff] Shutdown: done

Noted while reviewing bitcoin-core/gui#4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions