From fa061bfcdb0caea240fd15bcc309e7847132a4ff Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Wed, 7 May 2025 17:41:02 +0200 Subject: [PATCH] Remove create options from wallet tool Just create descriptor wallets. --- src/bitcoin-wallet.cpp | 4 +--- src/wallet/wallettool.cpp | 20 -------------------- test/functional/tool_wallet.py | 6 +++--- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index 51caae0a10..c8715231ea 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -38,12 +38,10 @@ static void SetupWalletToolArgs(ArgsManager& argsman) argsman.AddArg("-wallet=", "Specify wallet name", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::OPTIONS); argsman.AddArg("-dumpfile=", "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); argsman.AddArg("-debug=", "Output debugging information (default: 0).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); - argsman.AddArg("-descriptors", "Create descriptors wallet. Only for 'create'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); - argsman.AddArg("-legacy", "Create legacy wallet. Only for 'create'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -debug is true, 0 otherwise).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); argsman.AddCommand("info", "Get wallet info"); - argsman.AddCommand("create", "Create new wallet file"); + argsman.AddCommand("create", "Create a new descriptor wallet file"); argsman.AddCommand("dump", "Print out all of the wallet key-value records"); argsman.AddCommand("createfromdump", "Create new wallet file from dumped records"); } diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp index 4ab1dd5e45..228f3efbfb 100644 --- a/src/wallet/wallettool.cpp +++ b/src/wallet/wallettool.cpp @@ -112,26 +112,6 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command) tfm::format(std::cerr, "The -dumpfile option can only be used with the \"dump\" and \"createfromdump\" commands.\n"); return false; } - if (args.IsArgSet("-descriptors")) { - if (command != "create") { - tfm::format(std::cerr, "The -descriptors option can only be used with the 'create' command.\n"); - return false; - } - if (!args.GetBoolArg("-descriptors", true)) { - tfm::format(std::cerr, "The -descriptors option must be set to \"true\"\n"); - return false; - } - } - if (args.IsArgSet("-legacy")) { - if (command != "create") { - tfm::format(std::cerr, "The -legacy option can only be used with the 'create' command.\n"); - return false; - } - if (args.GetBoolArg("-legacy", true)) { - tfm::format(std::cerr, "The -legacy option must be set to \"false\"\n"); - return false; - } - } if (command == "create" && !args.IsArgSet("-wallet")) { tfm::format(std::cerr, "Wallet name must be provided when creating a new wallet.\n"); return false; diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py index 2f8373ff36..bbf84d7a01 100755 --- a/test/functional/tool_wallet.py +++ b/test/functional/tool_wallet.py @@ -274,7 +274,7 @@ class ToolWalletTest(BitcoinTestFramework): self.assert_raises_tool_error('Dump file {} does not exist.'.format(non_exist_dump), '-wallet=todump', '-dumpfile={}'.format(non_exist_dump), 'createfromdump') wallet_path = self.nodes[0].wallets_path / "todump2" self.assert_raises_tool_error('Failed to create database path \'{}\'. Database already exists.'.format(wallet_path), '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump') - self.assert_raises_tool_error("The -descriptors option can only be used with the 'create' command.", '-descriptors', '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump') + self.assert_raises_tool_error("Invalid parameter -descriptors", '-descriptors', '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump') self.log.info('Checking createfromdump') self.do_tool_createfromdump("load", "wallet.dump") @@ -416,9 +416,9 @@ class ToolWalletTest(BitcoinTestFramework): def test_no_create_legacy(self): self.log.info("Test that legacy wallets cannot be created") - self.assert_raises_tool_error("The -legacy option must be set to \"false\"", "-wallet=legacy", "-legacy", "create") + self.assert_raises_tool_error("Invalid parameter -legacy", "-wallet=legacy", "-legacy", "create") assert not (self.nodes[0].wallets_path / "legacy").exists() - self.assert_raises_tool_error("The -descriptors option must be set to \"true\"", "-wallet=legacy", "-descriptors=false", "create") + self.assert_raises_tool_error("Invalid parameter -descriptors", "-wallet=legacy", "-descriptors=false", "create") assert not (self.nodes[0].wallets_path / "legacy").exists() def run_test(self):