From abcec01ed55f84d43837277435be5a7bdfca72bd Mon Sep 17 00:00:00 2001 From: Martin Zumsande Date: Fri, 18 Apr 2025 17:41:12 -0400 Subject: [PATCH] test: Don't send empty named args with cli If python passed None for an optional (i.e. 'null' is sent), this will lead to the arg being interpreted as not provided by bitcoind - except for string args, for which the arg is interpreted as as 'null' string. Bypass this by not sending named args to bitcoin-cli - so that the default value will actually be used. The issue still persists for positional args, but the existing test "wallet_labels.py" affected by this can be changed to use named args instead. This also makes wallet_labels.py --usecli no longer fail. --- test/functional/test_framework/test_node.py | 6 +++--- test/functional/wallet_address_types.py | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 86af133a444..52f6538795e 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -899,7 +899,7 @@ class TestNodeCLI(): def send_cli(self, clicommand=None, *args, **kwargs): """Run bitcoin-cli command. Deserializes returned string as python object.""" pos_args = [arg_to_cli(arg) for arg in args] - named_args = [str(key) + "=" + arg_to_cli(value) for (key, value) in kwargs.items()] + named_args = [str(key) + "=" + arg_to_cli(value) for (key, value) in kwargs.items() if value is not None] p_args = self.binaries.rpc_argv() + [f"-datadir={self.datadir}"] + self.options if named_args: p_args += ["-named"] @@ -952,8 +952,8 @@ class RPCOverloadWrapper(): def addmultisigaddress(self, nrequired, keys, label=None, address_type=None): wallet_info = self.getwalletinfo() if 'descriptors' not in wallet_info or ('descriptors' in wallet_info and not wallet_info['descriptors']): - return self.__getattr__('addmultisigaddress')(nrequired, keys, label, address_type) - cms = self.createmultisig(nrequired, keys, address_type) + return self.__getattr__('addmultisigaddress')(nrequired, keys, label, address_type=address_type) + cms = self.createmultisig(nrequired, keys, address_type=address_type) req = [{ 'desc': cms['descriptor'], 'timestamp': 0, diff --git a/test/functional/wallet_address_types.py b/test/functional/wallet_address_types.py index 27adb155951..1ceaddc338c 100755 --- a/test/functional/wallet_address_types.py +++ b/test/functional/wallet_address_types.py @@ -78,7 +78,6 @@ class AddressTypeTest(BitcoinTestFramework): ] # whitelist peers to speed up tx relay / mempool sync self.noban_tx_relay = True - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet()