Skip to content

Commit

Permalink
Merge bitcoin#23712: test: interface_bitcoin_cli.py: check specified …
Browse files Browse the repository at this point in the history
…wallet type availability

b57bf25 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
   bitcoin#23686 (comment)

  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 bitcoin#23682.

ACKs for top commit:
  achow101:
    ACK b57bf25

Tree-SHA512: ddb5a94ba61133eff8de79d4946b3b9d476232b26e83bf768894cac4691e72602f88b6c02c72b992e12c2feb9bff1f0a2e0a265948a00954311104add1347184
  • Loading branch information
MarcoFalke authored and vijaydasmp committed Nov 25, 2024
1 parent f9d044d commit 0902963
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/functional/interface_bitcoin_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 0902963

Please sign in to comment.