Skip to content

Commit 02feae5

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#23002: Make descriptor wallets by default
9c1052a wallet: Default new wallets to descriptor wallets (Andrew Chow) f19ad40 rpc, wallet: Descriptor wallets are no longer experimental (Andrew Chow) Pull request description: Changes the default wallet type from legacy to descriptors. Descriptor wallets will now by the default type. Additionally, descriptor wallets will no longer be marked as experimental. This follows the timeline proposed in #20160 ACKs for top commit: lsilva01: Tested ACK bitcoin/bitcoin@9c1052a on Ubuntu 20.04 prayank23: tACK bitcoin/bitcoin@9c1052a meshcollider: Code review ACK 9c1052a Tree-SHA512: 834e6fec88e0c18673af7ebe135bd5333694d1be502164eb93a90e3e76c27974165aa4e59426945100c88e4eca07356e16886ef5b05cf789683ecb23fc71a12a
2 parents 788909f + 9c1052a commit 02feae5

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

src/bitcoin-wallet.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static void SetupWalletToolArgs(ArgsManager& argsman)
3030
argsman.AddArg("-dumpfile=<file name>", "When used with 'dump', writes out the records to this file. When used with 'createfromdump', loads the records into a new wallet.", ArgsManager::ALLOW_STRING, OptionsCategory::OPTIONS);
3131
argsman.AddArg("-debug=<category>", "Output debugging information (default: 0).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
3232
argsman.AddArg("-descriptors", "Create descriptors wallet. Only for 'create'", ArgsManager::ALLOW_BOOL, OptionsCategory::OPTIONS);
33+
argsman.AddArg("-legacy", "Create legacy wallet. Only for 'create'", ArgsManager::ALLOW_BOOL, OptionsCategory::OPTIONS);
3334
argsman.AddArg("-format=<format>", "The format of the wallet file to create. Either \"bdb\" or \"sqlite\". Only used with 'createfromdump'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
3435
argsman.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -debug is true, 0 otherwise).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
3536

src/qt/forms/createwalletdialog.ui

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@
107107
<property name="text">
108108
<string>Descriptor Wallet</string>
109109
</property>
110+
<property name="checked">
111+
<bool>true</bool>
112+
</property>
110113
</widget>
111114
</item>
112115
<item>

src/wallet/rpcwallet.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,7 +2770,7 @@ static RPCHelpMan createwallet()
27702770
{"blank", RPCArg::Type::BOOL, RPCArg::Default{false}, "Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed."},
27712771
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Encrypt the wallet with this passphrase."},
27722772
{"avoid_reuse", RPCArg::Type::BOOL, RPCArg::Default{false}, "Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind."},
2773-
{"descriptors", RPCArg::Type::BOOL, RPCArg::Default{false}, "Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation"},
2773+
{"descriptors", RPCArg::Type::BOOL, RPCArg::Default{true}, "Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation"},
27742774
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED_NAMED_ARG, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},
27752775
{"external_signer", RPCArg::Type::BOOL, RPCArg::Default{false}, "Use an external signer such as a hardware wallet. Requires -signer to be configured. Wallet creation will fail if keys cannot be fetched. Requires disable_private_keys and descriptors set to true."},
27762776
},
@@ -2812,12 +2812,11 @@ static RPCHelpMan createwallet()
28122812
if (!request.params[4].isNull() && request.params[4].get_bool()) {
28132813
flags |= WALLET_FLAG_AVOID_REUSE;
28142814
}
2815-
if (!request.params[5].isNull() && request.params[5].get_bool()) {
2815+
if (request.params[5].isNull() || request.params[5].get_bool()) {
28162816
#ifndef USE_SQLITE
28172817
throw JSONRPCError(RPC_WALLET_ERROR, "Compiled without sqlite support (required for descriptor wallets)");
28182818
#endif
28192819
flags |= WALLET_FLAG_DESCRIPTORS;
2820-
warnings.emplace_back(Untranslated("Wallet is an experimental descriptor wallet"));
28212820
}
28222821
if (!request.params[7].isNull() && request.params[7].get_bool()) {
28232822
#ifdef ENABLE_EXTERNAL_SIGNER

src/wallet/wallettool.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command)
120120
tfm::format(std::cerr, "The -descriptors option can only be used with the 'create' command.\n");
121121
return false;
122122
}
123+
if (args.IsArgSet("-legacy") && command != "create") {
124+
tfm::format(std::cerr, "The -legacy option can only be used with the 'create' command.\n");
125+
return false;
126+
}
123127
if (command == "create" && !args.IsArgSet("-wallet")) {
124128
tfm::format(std::cerr, "Wallet name must be provided when creating a new wallet.\n");
125129
return false;
@@ -130,7 +134,19 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command)
130134
if (command == "create") {
131135
DatabaseOptions options;
132136
options.require_create = true;
133-
if (args.GetBoolArg("-descriptors", false)) {
137+
// If -legacy is set, use it. Otherwise default to false.
138+
bool make_legacy = args.GetBoolArg("-legacy", false);
139+
// If neither -legacy nor -descriptors is set, default to true. If -descriptors is set, use its value.
140+
bool make_descriptors = (!args.IsArgSet("-descriptors") && !args.IsArgSet("-legacy")) || (args.IsArgSet("-descriptors") && args.GetBoolArg("-descriptors", true));
141+
if (make_legacy && make_descriptors) {
142+
tfm::format(std::cerr, "Only one of -legacy or -descriptors can be set to true, not both\n");
143+
return false;
144+
}
145+
if (!make_legacy && !make_descriptors) {
146+
tfm::format(std::cerr, "One of -legacy or -descriptors must be set to true (or omitted)\n");
147+
return false;
148+
}
149+
if (make_descriptors) {
134150
options.create_flags |= WALLET_FLAG_DESCRIPTORS;
135151
options.require_format = DatabaseFormat::SQLITE;
136152
}

test/functional/tool_wallet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def skip_test_if_missing_module(self):
3131
def bitcoin_wallet_process(self, *args):
3232
binary = self.config["environment"]["BUILDDIR"] + '/src/bitcoin-wallet' + self.config["environment"]["EXEEXT"]
3333
default_args = ['-datadir={}'.format(self.nodes[0].datadir), '-chain=%s' % self.chain]
34-
if self.options.descriptors and 'create' in args:
35-
default_args.append('-descriptors')
34+
if not self.options.descriptors and 'create' in args:
35+
default_args.append('-legacy')
3636

3737
return subprocess.Popen([binary] + default_args + list(args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
3838

0 commit comments

Comments
 (0)