Skip to content

Commit fa061bf

Browse files
author
MarcoFalke
committed
Remove create options from wallet tool
Just create descriptor wallets.
1 parent fa2125e commit fa061bf

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

src/bitcoin-wallet.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ static void SetupWalletToolArgs(ArgsManager& argsman)
3838
argsman.AddArg("-wallet=<wallet-name>", "Specify wallet name", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::OPTIONS);
3939
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_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::OPTIONS);
4040
argsman.AddArg("-debug=<category>", "Output debugging information (default: 0).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
41-
argsman.AddArg("-descriptors", "Create descriptors wallet. Only for 'create'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
42-
argsman.AddArg("-legacy", "Create legacy wallet. Only for 'create'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
4341
argsman.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -debug is true, 0 otherwise).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
4442

4543
argsman.AddCommand("info", "Get wallet info");
46-
argsman.AddCommand("create", "Create new wallet file");
44+
argsman.AddCommand("create", "Create a new descriptor wallet file");
4745
argsman.AddCommand("dump", "Print out all of the wallet key-value records");
4846
argsman.AddCommand("createfromdump", "Create new wallet file from dumped records");
4947
}

src/wallet/wallettool.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -112,26 +112,6 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command)
112112
tfm::format(std::cerr, "The -dumpfile option can only be used with the \"dump\" and \"createfromdump\" commands.\n");
113113
return false;
114114
}
115-
if (args.IsArgSet("-descriptors")) {
116-
if (command != "create") {
117-
tfm::format(std::cerr, "The -descriptors option can only be used with the 'create' command.\n");
118-
return false;
119-
}
120-
if (!args.GetBoolArg("-descriptors", true)) {
121-
tfm::format(std::cerr, "The -descriptors option must be set to \"true\"\n");
122-
return false;
123-
}
124-
}
125-
if (args.IsArgSet("-legacy")) {
126-
if (command != "create") {
127-
tfm::format(std::cerr, "The -legacy option can only be used with the 'create' command.\n");
128-
return false;
129-
}
130-
if (args.GetBoolArg("-legacy", true)) {
131-
tfm::format(std::cerr, "The -legacy option must be set to \"false\"\n");
132-
return false;
133-
}
134-
}
135115
if (command == "create" && !args.IsArgSet("-wallet")) {
136116
tfm::format(std::cerr, "Wallet name must be provided when creating a new wallet.\n");
137117
return false;

test/functional/tool_wallet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def test_dump_createfromdump(self):
274274
self.assert_raises_tool_error('Dump file {} does not exist.'.format(non_exist_dump), '-wallet=todump', '-dumpfile={}'.format(non_exist_dump), 'createfromdump')
275275
wallet_path = self.nodes[0].wallets_path / "todump2"
276276
self.assert_raises_tool_error('Failed to create database path \'{}\'. Database already exists.'.format(wallet_path), '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
277-
self.assert_raises_tool_error("The -descriptors option can only be used with the 'create' command.", '-descriptors', '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
277+
self.assert_raises_tool_error("Invalid parameter -descriptors", '-descriptors', '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
278278

279279
self.log.info('Checking createfromdump')
280280
self.do_tool_createfromdump("load", "wallet.dump")
@@ -416,9 +416,9 @@ def test_dump_very_large_records(self):
416416
def test_no_create_legacy(self):
417417
self.log.info("Test that legacy wallets cannot be created")
418418

419-
self.assert_raises_tool_error("The -legacy option must be set to \"false\"", "-wallet=legacy", "-legacy", "create")
419+
self.assert_raises_tool_error("Invalid parameter -legacy", "-wallet=legacy", "-legacy", "create")
420420
assert not (self.nodes[0].wallets_path / "legacy").exists()
421-
self.assert_raises_tool_error("The -descriptors option must be set to \"true\"", "-wallet=legacy", "-descriptors=false", "create")
421+
self.assert_raises_tool_error("Invalid parameter -descriptors", "-wallet=legacy", "-descriptors=false", "create")
422422
assert not (self.nodes[0].wallets_path / "legacy").exists()
423423

424424
def run_test(self):

0 commit comments

Comments
 (0)