From 2c4f8ed823fd0455f6b0362fc7d5adcb823f8cde Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 8 Dec 2021 18:29:54 +0100 Subject: [PATCH 1/2] Merge bitcoin/bitcoin#23712: test: interface_bitcoin_cli.py: check specified wallet type availability b57bf25cfee3d3d0e08e5565b23e5e12ea88aee5 test: interface_bitcoin_cli.py: check specified wallet type availability (Sebastian Falbesoner) Pull request description: Currently the test `interface_bitcoin_cli.py` performs the wallet-relevant parts if _any_ wallet type support is compiled in, independently of whether the test is run with legacy or descriptor wallet specified. This leads to a failure if the test is started with the `--legacy-wallet` parameter, but bitcoind is compiled without BDB support, see e.g https://github.com/bitcoin/bitcoin/pull/23686#issuecomment-987705540 Fix this by checking if the specified wallet type (BDB for legacy wallet, SQLite for descriptor wallet) is available. Should further pave the way for #23682. ACKs for top commit: achow101: ACK b57bf25cfee3d3d0e08e5565b23e5e12ea88aee5 Tree-SHA512: ddb5a94ba61133eff8de79d4946b3b9d476232b26e83bf768894cac4691e72602f88b6c02c72b992e12c2feb9bff1f0a2e0a265948a00954311104add1347184 --- test/functional/interface_bitcoin_cli.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/functional/interface_bitcoin_cli.py b/test/functional/interface_bitcoin_cli.py index 671ba832dd7ec..6e1a8d5b4d630 100755 --- a/test/functional/interface_bitcoin_cli.py +++ b/test/functional/interface_bitcoin_cli.py @@ -66,10 +66,16 @@ def cli_get_info_string_to_dict(cli_get_info_string): class TestBitcoinCli(BitcoinTestFramework): + def is_specified_wallet_compiled(self): + if self.options.descriptors: + return self.is_sqlite_compiled() + else: + return self.is_bdb_compiled() + def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 1 - if self.is_wallet_compiled(): + if self.is_specified_wallet_compiled(): self.requires_wallet = True def skip_test_if_missing_module(self): @@ -122,7 +128,7 @@ def run_test(self): assert_raises_process_error(1, "Invalid value for -color option. Valid values: always, auto, never.", self.nodes[0].cli('-getinfo', '-color=foo').send_cli) self.log.info("Test -getinfo returns expected network and blockchain info") - if self.is_wallet_compiled(): + if self.is_specified_wallet_compiled(): self.nodes[0].encryptwallet(password) cli_get_info_string = self.nodes[0].cli('-getinfo').send_cli() cli_get_info = cli_get_info_string_to_dict(cli_get_info_string) @@ -147,7 +153,7 @@ def run_test(self): cli_get_info = cli_get_info_string_to_dict(cli_get_info_string) assert_equal(cli_get_info["Proxies"], "127.0.0.1:9050 (ipv4, ipv6, onion, cjdns), 127.0.0.1:7656 (i2p)") - if self.is_wallet_compiled(): + if self.is_specified_wallet_compiled(): self.log.info("Test -getinfo and dash-cli getwalletinfo return expected wallet info") assert_equal(Decimal(cli_get_info['Balance']), BALANCE) assert 'Balances' not in cli_get_info_string From 321a21a43f064312eb2ef369e2557ed9f92e61a0 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 9 Dec 2021 13:44:11 +0100 Subject: [PATCH 2/2] Merge bitcoin/bitcoin#23346: util, refactor: Improve headers for bitcoin-wallet tool 3431839c33fa3892c982322e4add39e28ddba719 util, refactor: Improve headers for bitcoin-wallet tool (Hennadii Stepanov) Pull request description: This PR: - removes unneeded `#include ` from `` - introduces class forward declaration in `` - added `#include ` to `wallet/wallettool.cpp` where the `USE_BDB` macro is used Top commit has no ACKs. Tree-SHA512: a0de560d821f8b570ae806a1165b9b382c9e0b339687d932052fa4c38ab2ba493e7e050f19adc02ad7db40c42cf88ac1d37209f9071494a0ab268ed33ff22b9f --- src/bitcoin-wallet.cpp | 7 +++++++ src/wallet/wallettool.cpp | 6 ++++++ src/wallet/wallettool.h | 5 +++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index 4dfb973042223..b8e17693b40fe 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -11,11 +11,18 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include +#include +#include +#include const std::function G_TRANSLATION_FUN = nullptr; UrlDecodeFn* const URL_DECODE = nullptr; diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp index 96ca344c4e545..98271775c527b 100644 --- a/src/wallet/wallettool.cpp +++ b/src/wallet/wallettool.cpp @@ -2,6 +2,12 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include + #include #include #include diff --git a/src/wallet/wallettool.h b/src/wallet/wallettool.h index f4516bb5bc88f..09be1dac2cabd 100644 --- a/src/wallet/wallettool.h +++ b/src/wallet/wallettool.h @@ -5,11 +5,12 @@ #ifndef BITCOIN_WALLET_WALLETTOOL_H #define BITCOIN_WALLET_WALLETTOOL_H -#include +#include + +class ArgsManager; namespace WalletTool { -void WalletShowInfo(CWallet* wallet_instance); bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command); } // namespace WalletTool