diff --git a/test/functional/feature_assumeutxo.py b/test/functional/feature_assumeutxo.py index 2680fc4e410..cc0f7fb6e19 100755 --- a/test/functional/feature_assumeutxo.py +++ b/test/functional/feature_assumeutxo.py @@ -38,6 +38,7 @@ from test_framework.util import ( assert_equal, assert_not_equal, assert_raises_rpc_error, + convert_to_json_for_cli, ensure_for, sha256sum_file, try_rpc, @@ -481,7 +482,7 @@ class AssumeutxoTest(BitcoinTestFramework): # Use a hash instead of a height prev_snap_hash = n0.getblockhash(prev_snap_height) - dump_output5 = n0.dumptxoutset('utxos5.dat', rollback=prev_snap_hash) + dump_output5 = n0.dumptxoutset('utxos5.dat', rollback=convert_to_json_for_cli(self.options.usecli, prev_snap_hash)) assert_equal(sha256sum_file(dump_output4['path']), sha256sum_file(dump_output5['path'])) # TODO: This is a hack to set m_best_header to the correct value after diff --git a/test/functional/feature_coinstatsindex.py b/test/functional/feature_coinstatsindex.py index a2363c4acfd..457d73f365c 100755 --- a/test/functional/feature_coinstatsindex.py +++ b/test/functional/feature_coinstatsindex.py @@ -30,6 +30,7 @@ from test_framework.util import ( assert_not_equal, assert_equal, assert_raises_rpc_error, + convert_to_json_for_cli, ) from test_framework.wallet import ( MiniWallet, @@ -41,7 +42,6 @@ class CoinStatsIndexTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 2 - self.supports_cli = False self.extra_args = [ [], ["-coinstatsindex"] @@ -104,7 +104,7 @@ class CoinStatsIndexTest(BitcoinTestFramework): assert_equal(res0, res2) # Fetch old stats by hash - res3 = index_node.gettxoutsetinfo(hash_option, res0['bestblock']) + res3 = index_node.gettxoutsetinfo(hash_option, convert_to_json_for_cli(self.options.usecli, res0['bestblock'])) del res3['block_info'], res3['total_unspendable_amount'] res3.pop('muhash', None) assert_equal(res0, res3) @@ -244,7 +244,7 @@ class CoinStatsIndexTest(BitcoinTestFramework): assert_equal(res12, res10) self.log.info("Test obtaining info for a non-existent block hash") - assert_raises_rpc_error(-5, "Block not found", index_node.gettxoutsetinfo, hash_type="none", hash_or_height="ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", use_index=True) + assert_raises_rpc_error(-5, "Block not found", index_node.gettxoutsetinfo, hash_type="none", hash_or_height=convert_to_json_for_cli(self.options.usecli, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), use_index=True) def _test_use_index_option(self): self.log.info("Test use_index option for nodes running the index") @@ -279,7 +279,7 @@ class CoinStatsIndexTest(BitcoinTestFramework): assert_not_equal(res["muhash"], res_invalid["muhash"]) # Test that requesting reorged out block by hash is still returning correct results - res_invalid2 = index_node.gettxoutsetinfo(hash_type='muhash', hash_or_height=reorg_block) + res_invalid2 = index_node.gettxoutsetinfo(hash_type='muhash', hash_or_height=convert_to_json_for_cli(self.options.usecli, reorg_block)) assert_equal(res_invalid2["muhash"], res_invalid["muhash"]) assert_not_equal(res["muhash"], res_invalid2["muhash"]) diff --git a/test/functional/feature_fastprune.py b/test/functional/feature_fastprune.py index ca6877b9019..1338ebfe7ef 100755 --- a/test/functional/feature_fastprune.py +++ b/test/functional/feature_fastprune.py @@ -14,6 +14,7 @@ class FeatureFastpruneTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 self.extra_args = [["-fastprune"]] + self.supports_cli = False def run_test(self): self.log.info("ensure that large blocks don't crash or freeze in -fastprune") diff --git a/test/functional/feature_fee_estimation.py b/test/functional/feature_fee_estimation.py index 61db186de17..bf16bf6c482 100755 --- a/test/functional/feature_fee_estimation.py +++ b/test/functional/feature_fee_estimation.py @@ -148,6 +148,7 @@ class EstimateFeeTest(BitcoinTestFramework): ["-blockmaxweight=68000"], ["-blockmaxweight=32000"], ] + self.supports_cli = False def setup_network(self): """ diff --git a/test/functional/feature_reindex_readonly.py b/test/functional/feature_reindex_readonly.py index 858a67566f9..393972b67d9 100755 --- a/test/functional/feature_reindex_readonly.py +++ b/test/functional/feature_reindex_readonly.py @@ -17,6 +17,7 @@ class BlockstoreReindexTest(BitcoinTestFramework): self.setup_clean_chain = True self.num_nodes = 1 self.extra_args = [["-fastprune"]] + self.supports_cli = False def reindex_readonly(self): self.log.debug("Generate block big enough to start second block file") diff --git a/test/functional/feature_taproot.py b/test/functional/feature_taproot.py index 68fde4eaa88..ee91e33607d 100755 --- a/test/functional/feature_taproot.py +++ b/test/functional/feature_taproot.py @@ -1320,6 +1320,7 @@ class TaprootTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 self.setup_clean_chain = True + self.supports_cli = False def block_submit(self, node, txs, msg, err_msg, cb_pubkey=None, fees=0, sigops_weight=0, witness=False, accept=False): diff --git a/test/functional/mempool_package_rbf.py b/test/functional/mempool_package_rbf.py index 4dc6f8fe364..73b1c25ef35 100755 --- a/test/functional/mempool_package_rbf.py +++ b/test/functional/mempool_package_rbf.py @@ -36,6 +36,7 @@ class PackageRBFTest(BitcoinTestFramework): "-datacarriersize=100000", "-maxmempool=5", ]] * self.num_nodes + self.supports_cli = False def assert_mempool_contents(self, expected=None): mempool_util.assert_mempool_contents(self, self.nodes[0], expected, sync=False) diff --git a/test/functional/p2p_net_deadlock.py b/test/functional/p2p_net_deadlock.py index 4f1b731e218..cb734a72ed2 100755 --- a/test/functional/p2p_net_deadlock.py +++ b/test/functional/p2p_net_deadlock.py @@ -12,6 +12,7 @@ class NetDeadlockTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 2 + self.supports_cli = False def run_test(self): node0 = self.nodes[0] diff --git a/test/functional/p2p_tx_download.py b/test/functional/p2p_tx_download.py index 2b75c1193d1..e7ab3c07496 100755 --- a/test/functional/p2p_tx_download.py +++ b/test/functional/p2p_tx_download.py @@ -69,6 +69,7 @@ class TxDownloadTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 2 self.extra_args= [['-datacarriersize=100000', '-maxmempool=5', '-persistmempool=0']] * self.num_nodes + self.supports_cli = False def test_tx_requests(self): self.log.info("Test that we request transactions from all our peers, eventually") diff --git a/test/functional/rpc_createmultisig.py b/test/functional/rpc_createmultisig.py index daf350d4153..17b1d347fd6 100755 --- a/test/functional/rpc_createmultisig.py +++ b/test/functional/rpc_createmultisig.py @@ -28,7 +28,6 @@ class RpcCreateMultiSigTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 3 - self.supports_cli = False def create_keys(self, num_keys): self.pub = [] diff --git a/test/functional/rpc_deprecated.py b/test/functional/rpc_deprecated.py index 043577ef111..f26d9f0815c 100755 --- a/test/functional/rpc_deprecated.py +++ b/test/functional/rpc_deprecated.py @@ -32,7 +32,7 @@ class DeprecatedRpcTest(BitcoinTestFramework): self.log.info("Tests for deprecated wallet-related RPC methods (if any)") self.log.info("Test settxfee RPC deprecation") self.nodes[0].createwallet("settxfeerpc") - assert_raises_rpc_error(-32, 'settxfee is deprecated and will be fully removed in v31.0.', self.nodes[0].rpc.settxfee, 0.01) + assert_raises_rpc_error(-32, 'settxfee is deprecated and will be fully removed in v31.0.', self.nodes[0].settxfee, 0.01) if __name__ == '__main__': DeprecatedRpcTest(__file__).main() diff --git a/test/functional/rpc_estimatefee.py b/test/functional/rpc_estimatefee.py index 05ceafbe4e0..2b8772269ed 100755 --- a/test/functional/rpc_estimatefee.py +++ b/test/functional/rpc_estimatefee.py @@ -21,17 +21,17 @@ class EstimateFeeTest(BitcoinTestFramework): assert_raises_rpc_error(-1, "estimatesmartfee", self.nodes[0].estimatesmartfee) assert_raises_rpc_error(-1, "estimaterawfee", self.nodes[0].estimaterawfee) - # wrong type for conf_target - assert_raises_rpc_error(-3, "JSON value of type string is not of expected type number", self.nodes[0].estimatesmartfee, 'foo') - assert_raises_rpc_error(-3, "JSON value of type string is not of expected type number", self.nodes[0].estimaterawfee, 'foo') + # cli handles wrong types differently + if not self.options.usecli: + # wrong type for conf_target + assert_raises_rpc_error(-3, "JSON value of type string is not of expected type number", self.nodes[0].estimatesmartfee, 'foo') + assert_raises_rpc_error(-3, "JSON value of type string is not of expected type number", self.nodes[0].estimaterawfee, 'foo') + # wrong type for estimatesmartfee(estimate_mode) + assert_raises_rpc_error(-3, "JSON value of type number is not of expected type string", self.nodes[0].estimatesmartfee, 1, 1) + # wrong type for estimaterawfee(threshold) + assert_raises_rpc_error(-3, "JSON value of type string is not of expected type number", self.nodes[0].estimaterawfee, 1, 'foo') - # wrong type for estimatesmartfee(estimate_mode) - assert_raises_rpc_error(-3, "JSON value of type number is not of expected type string", self.nodes[0].estimatesmartfee, 1, 1) assert_raises_rpc_error(-8, 'Invalid estimate_mode parameter, must be one of: "unset", "economical", "conservative"', self.nodes[0].estimatesmartfee, 1, 'foo') - - # wrong type for estimaterawfee(threshold) - assert_raises_rpc_error(-3, "JSON value of type string is not of expected type number", self.nodes[0].estimaterawfee, 1, 'foo') - # extra params assert_raises_rpc_error(-1, "estimatesmartfee", self.nodes[0].estimatesmartfee, 1, 'ECONOMICAL', 1) assert_raises_rpc_error(-1, "estimaterawfee", self.nodes[0].estimaterawfee, 1, 1, 1) diff --git a/test/functional/rpc_generate.py b/test/functional/rpc_generate.py index 618bbb2e007..fdaaf4cbec4 100755 --- a/test/functional/rpc_generate.py +++ b/test/functional/rpc_generate.py @@ -124,11 +124,12 @@ class RPCGenerateTest(BitcoinTestFramework): "cli option. Refer to -help for more information.\n" ) - self.log.info("Test rpc generate raises with message to use cli option") - assert_raises_rpc_error(-32601, message, self.nodes[0].rpc.generate) + if not self.options.usecli: + self.log.info("Test rpc generate raises with message to use cli option") + assert_raises_rpc_error(-32601, message, self.nodes[0].rpc.generate) - self.log.info("Test rpc generate help prints message to use cli option") - assert_equal(message, self.nodes[0].help("generate")) + self.log.info("Test rpc generate help prints message to use cli option") + assert_equal(message, self.nodes[0].help("generate")) self.log.info("Test rpc generate is a hidden command not discoverable in general help") assert message not in self.nodes[0].help() diff --git a/test/functional/rpc_getblockfrompeer.py b/test/functional/rpc_getblockfrompeer.py index 62b3d664e0f..3a32d83018c 100755 --- a/test/functional/rpc_getblockfrompeer.py +++ b/test/functional/rpc_getblockfrompeer.py @@ -67,8 +67,11 @@ class GetBlockFromPeerTest(BitcoinTestFramework): self.log.info("Arguments must be valid") assert_raises_rpc_error(-8, "hash must be of length 64 (not 4, for '1234')", self.nodes[0].getblockfrompeer, "1234", peer_0_peer_1_id) - assert_raises_rpc_error(-3, "JSON value of type number is not of expected type string", self.nodes[0].getblockfrompeer, 1234, peer_0_peer_1_id) - assert_raises_rpc_error(-3, "JSON value of type string is not of expected type number", self.nodes[0].getblockfrompeer, short_tip, "0") + + # cli handles wrong types differently + if not self.options.usecli: + assert_raises_rpc_error(-3, "JSON value of type number is not of expected type string", self.nodes[0].getblockfrompeer, 1234, peer_0_peer_1_id) + assert_raises_rpc_error(-3, "JSON value of type string is not of expected type number", self.nodes[0].getblockfrompeer, short_tip, "0") self.log.info("We must already have the header") assert_raises_rpc_error(-1, "Block header missing", self.nodes[0].getblockfrompeer, "00" * 32, 0) diff --git a/test/functional/rpc_getblockstats.py b/test/functional/rpc_getblockstats.py index 002763201a5..03ae5cb2226 100755 --- a/test/functional/rpc_getblockstats.py +++ b/test/functional/rpc_getblockstats.py @@ -12,6 +12,7 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, assert_raises_rpc_error, + convert_to_json_for_cli, ) import json import os @@ -35,7 +36,6 @@ class GetblockstatsTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 self.setup_clean_chain = True - self.supports_cli = False def get_stats(self): return [self.nodes[0].getblockstats(hash_or_height=self.start_height + i) for i in range(self.max_stat_pos+1)] @@ -119,7 +119,7 @@ class GetblockstatsTest(BitcoinTestFramework): # Check selecting block by hash too blockhash = self.expected_stats[i]['blockhash'] - stats_by_hash = self.nodes[0].getblockstats(hash_or_height=blockhash) + stats_by_hash = self.nodes[0].getblockstats(hash_or_height=convert_to_json_for_cli(self.options.usecli, blockhash)) assert_equal(stats_by_hash, self.expected_stats[i]) # Make sure each stat can be queried on its own @@ -161,10 +161,10 @@ class GetblockstatsTest(BitcoinTestFramework): self.nodes[0].getblockstats, hash_or_height=1, stats=['minfee', f'aaa{inv_sel_stat}']) # Mainchain's genesis block shouldn't be found on regtest assert_raises_rpc_error(-5, 'Block not found', self.nodes[0].getblockstats, - hash_or_height='000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f') + hash_or_height=convert_to_json_for_cli(self.options.usecli,'000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f')) # Invalid number of args - assert_raises_rpc_error(-1, 'getblockstats hash_or_height ( stats )', self.nodes[0].getblockstats, '00', 1, 2) + assert_raises_rpc_error(-1, 'getblockstats hash_or_height ( stats )', self.nodes[0].getblockstats, convert_to_json_for_cli(self.options.usecli,'00'), 1, 2) assert_raises_rpc_error(-1, 'getblockstats hash_or_height ( stats )', self.nodes[0].getblockstats) self.log.info('Test block height 0') @@ -185,7 +185,7 @@ class GetblockstatsTest(BitcoinTestFramework): self.log.info("Test when only header is known") block = self.generateblock(self.nodes[0], output="raw(55)", transactions=[], submit=False) self.nodes[0].submitheader(block["hex"]) - assert_raises_rpc_error(-1, "Block not available (not fully downloaded)", lambda: self.nodes[0].getblockstats(block['hash'])) + assert_raises_rpc_error(-1, "Block not available (not fully downloaded)", lambda: self.nodes[0].getblockstats(convert_to_json_for_cli(self.options.usecli,block['hash']))) self.log.info('Test when block is missing') (self.nodes[0].blocks_path / 'blk00000.dat').rename(self.nodes[0].blocks_path / 'blk00000.dat.backup') diff --git a/test/functional/rpc_getdescriptorinfo.py b/test/functional/rpc_getdescriptorinfo.py index 65aa6dd47c8..56a8faaff98 100755 --- a/test/functional/rpc_getdescriptorinfo.py +++ b/test/functional/rpc_getdescriptorinfo.py @@ -35,7 +35,9 @@ class DescriptorTest(BitcoinTestFramework): def run_test(self): assert_raises_rpc_error(-1, 'getdescriptorinfo', self.nodes[0].getdescriptorinfo) - assert_raises_rpc_error(-3, 'JSON value of type number is not of expected type string', self.nodes[0].getdescriptorinfo, 1) + # cli handles wrong types differently + if not self.options.usecli: + assert_raises_rpc_error(-3, 'JSON value of type number is not of expected type string', self.nodes[0].getdescriptorinfo, 1) assert_raises_rpc_error(-5, "'' is not a valid descriptor function", self.nodes[0].getdescriptorinfo, "") assert_raises_rpc_error(-5, "pk(): Key ' 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798' is invalid due to whitespace", self.nodes[0].getdescriptorinfo, "pk( 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)") assert_raises_rpc_error(-5, "pk(): Key '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 ' is invalid due to whitespace", self.nodes[0].getdescriptorinfo, "pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 )") diff --git a/test/functional/rpc_help.py b/test/functional/rpc_help.py index 01a633a83d1..802a55492f2 100755 --- a/test/functional/rpc_help.py +++ b/test/functional/rpc_help.py @@ -45,7 +45,6 @@ def process_mapping(fname): class HelpRpcTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 - self.supports_cli = False self.uses_wallet = None def run_test(self): @@ -93,7 +92,8 @@ class HelpRpcTest(BitcoinTestFramework): assert_raises_rpc_error(-1, 'help', node.help, 'foo', 'bar') # invalid argument - assert_raises_rpc_error(-3, "JSON value of type number is not of expected type string", node.help, 0) + if not self.options.usecli: + assert_raises_rpc_error(-3, "JSON value of type number is not of expected type string", node.help, 0) # help of unknown command assert_equal(node.help('foo'), 'help: unknown command: foo') diff --git a/test/functional/rpc_invalid_address_message.py b/test/functional/rpc_invalid_address_message.py index bbd6955b563..25d8a68a1aa 100755 --- a/test/functional/rpc_invalid_address_message.py +++ b/test/functional/rpc_invalid_address_message.py @@ -97,10 +97,12 @@ class InvalidAddressErrorMessageTest(BitcoinTestFramework): node = self.nodes[0] - # Missing arg returns the help text - assert_raises_rpc_error(-1, "Return information about the given bitcoin address.", node.validateaddress) - # Explicit None is not allowed for required parameters - assert_raises_rpc_error(-3, "JSON value of type null is not of expected type string", node.validateaddress, None) + + if not self.options.usecli: + # Missing arg returns the help text + assert_raises_rpc_error(-1, "Return information about the given bitcoin address.", node.validateaddress) + # Explicit None is not allowed for required parameters + assert_raises_rpc_error(-3, "JSON value of type null is not of expected type string", node.validateaddress, None) def test_getaddressinfo(self): node = self.nodes[0] diff --git a/test/functional/rpc_packages.py b/test/functional/rpc_packages.py index a2f9210f94d..10c11f19683 100755 --- a/test/functional/rpc_packages.py +++ b/test/functional/rpc_packages.py @@ -38,6 +38,7 @@ class RPCPackagesTest(BitcoinTestFramework): self.setup_clean_chain = True # whitelist peers to speed up tx relay / mempool sync self.noban_tx_relay = True + self.supports_cli = False def assert_testres_equal(self, package_hex, testres_expected): """Shuffle package_hex and assert that the testmempoolaccept result matches testres_expected. This should only diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py index deb519803cf..51ba0015a9c 100755 --- a/test/functional/rpc_psbt.py +++ b/test/functional/rpc_psbt.py @@ -66,7 +66,6 @@ class PSBTTest(BitcoinTestFramework): # whitelist peers to speed up tx relay / mempool sync for args in self.extra_args: args.append("-whitelist=noban@127.0.0.1") - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() @@ -90,7 +89,7 @@ class PSBTTest(BitcoinTestFramework): signed_psbt_obj.g.map[PSBT_GLOBAL_UNSIGNED_TX] = bytes.fromhex(raw) # Check that the walletprocesspsbt call succeeds but also recognizes that the transaction is not complete - signed_psbt_incomplete = wallet.walletprocesspsbt(signed_psbt_obj.to_base64(), finalize=False) + signed_psbt_incomplete = wallet.walletprocesspsbt(psbt=signed_psbt_obj.to_base64(), finalize=False) assert signed_psbt_incomplete["complete"] is False def test_utxo_conversion(self): diff --git a/test/functional/rpc_whitelist.py b/test/functional/rpc_whitelist.py index a35c89fadd2..b103289fab3 100755 --- a/test/functional/rpc_whitelist.py +++ b/test/functional/rpc_whitelist.py @@ -33,6 +33,7 @@ class RPCWhitelistTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 + self.supports_cli = False def run_test(self): # 0 => Username diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 9f0baaccca2..c2af077643c 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -862,7 +862,7 @@ def arg_to_cli(arg): return str(arg).lower() elif arg is None: return 'null' - elif isinstance(arg, dict) or isinstance(arg, list): + elif isinstance(arg, dict) or isinstance(arg, list) or isinstance(arg, tuple): return json.dumps(arg, default=serialization_fallback) else: return str(arg) @@ -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"] @@ -948,8 +948,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/test_framework/util.py b/test/functional/test_framework/util.py index f7acc290a5b..91ed137e415 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -610,3 +610,8 @@ def sync_txindex(test_framework, node): sync_start = int(time.time()) test_framework.wait_until(lambda: node.getindexinfo("txindex")["txindex"]["synced"]) test_framework.log.debug(f"Synced in {time.time() - sync_start} seconds") + +def convert_to_json_for_cli(cli, text): + if cli: + return json.dumps(text) + return text diff --git a/test/functional/wallet_address_types.py b/test/functional/wallet_address_types.py index d8c2aab36de..0c4e9c9b388 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() diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py index 00ce40b4475..05965caacd3 100755 --- a/test/functional/wallet_bumpfee.py +++ b/test/functional/wallet_bumpfee.py @@ -139,8 +139,9 @@ class BumpFeeTest(BitcoinTestFramework): assert_raises_rpc_error(-8, msg, rbf_node.bumpfee, rbfid, fee_rate=zero_value) msg = "Invalid amount" # Test fee_rate values that don't pass fixed-point parsing checks. - for invalid_value in ["", 0.000000001, 1e-09, 1.111111111, 1111111111111111, "31.999999999999999999999"]: - assert_raises_rpc_error(-3, msg, rbf_node.bumpfee, rbfid, fee_rate=invalid_value) + if not self.options.usecli: + for invalid_value in ["", 0.000000001, 1e-09, 1.111111111, 1111111111111111, "31.999999999999999999999"]: + assert_raises_rpc_error(-3, msg, rbf_node.bumpfee, rbfid, fee_rate=invalid_value) # Test fee_rate values that cannot be represented in sat/vB. for invalid_value in [0.0001, 0.00000001, 0.00099999, 31.99999999]: assert_raises_rpc_error(-3, msg, rbf_node.bumpfee, rbfid, fee_rate=invalid_value) @@ -164,9 +165,10 @@ class BumpFeeTest(BitcoinTestFramework): rbf_node.bumpfee, rbfid, {"confTarget": 123, "conf_target": 456}) self.log.info("Test invalid estimate_mode settings") - for k, v in {"number": 42, "object": {"foo": "bar"}}.items(): - assert_raises_rpc_error(-3, f"JSON value of type {k} for field estimate_mode is not of expected type string", - rbf_node.bumpfee, rbfid, estimate_mode=v) + if not self.options.usecli: + for k, v in {"number": 42, "object": {"foo": "bar"}}.items(): + assert_raises_rpc_error(-3, f"JSON value of type {k} for field estimate_mode is not of expected type string", + rbf_node.bumpfee, rbfid, estimate_mode=v) for mode in ["foo", Decimal("3.1415"), "sat/B", "BTC/kB"]: assert_raises_rpc_error(-8, 'Invalid estimate_mode parameter, must be one of: "unset", "economical", "conservative"', rbf_node.bumpfee, rbfid, estimate_mode=mode) diff --git a/test/functional/wallet_encryption.py b/test/functional/wallet_encryption.py index b85c35cb12e..858bc64dd8a 100755 --- a/test/functional/wallet_encryption.py +++ b/test/functional/wallet_encryption.py @@ -90,14 +90,15 @@ class WalletEncryptionTest(BitcoinTestFramework): assert_equal(actual_time, expected_time) self.nodes[0].walletlock() - # Test passphrase with null characters - passphrase_with_nulls = "Phrase\0With\0Nulls" - self.nodes[0].walletpassphrasechange(passphrase2, passphrase_with_nulls) - # walletpassphrasechange should not stop at null characters - assert_raises_rpc_error(-14, "wallet passphrase entered was incorrect", self.nodes[0].walletpassphrase, passphrase_with_nulls.partition("\0")[0], 10) - with WalletUnlock(self.nodes[0], passphrase_with_nulls): - sig = self.nodes[0].signmessage(address, msg) - assert self.nodes[0].verifymessage(address, sig, msg) + if not self.options.usecli: # can't be done with the test framework for cli since subprocess.Popen doesn't allow null characters + # Test passphrase with null characters + passphrase_with_nulls = "Phrase\0With\0Nulls" + self.nodes[0].walletpassphrasechange(passphrase2, passphrase_with_nulls) + # walletpassphrasechange should not stop at null characters + assert_raises_rpc_error(-14, "wallet passphrase entered was incorrect", self.nodes[0].walletpassphrase, passphrase_with_nulls.partition("\0")[0], 10) + with WalletUnlock(self.nodes[0], passphrase_with_nulls): + sig = self.nodes[0].signmessage(address, msg) + assert self.nodes[0].verifymessage(address, sig, msg) self.log.info("Test that wallets without private keys cannot be encrypted") self.nodes[0].createwallet(wallet_name="noprivs", disable_private_keys=True) diff --git a/test/functional/wallet_fundrawtransaction.py b/test/functional/wallet_fundrawtransaction.py index aeaa8e54622..768c93eb485 100755 --- a/test/functional/wallet_fundrawtransaction.py +++ b/test/functional/wallet_fundrawtransaction.py @@ -49,6 +49,7 @@ class RawTransactionsTest(BitcoinTestFramework): # whitelist peers to speed up tx relay / mempool sync self.noban_tx_relay = True self.rpc_timeout = 90 # to prevent timeouts in `test_transaction_too_large` + self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/wallet_miniscript.py b/test/functional/wallet_miniscript.py index 302e03e4597..2de0992c62b 100755 --- a/test/functional/wallet_miniscript.py +++ b/test/functional/wallet_miniscript.py @@ -206,6 +206,7 @@ class WalletMiniscriptTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 self.rpc_timeout = 180 + self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/wallet_send.py b/test/functional/wallet_send.py index 067df43e50a..21761775c53 100755 --- a/test/functional/wallet_send.py +++ b/test/functional/wallet_send.py @@ -29,6 +29,7 @@ class WalletSendTest(BitcoinTestFramework): self.num_nodes = 2 # whitelist peers to speed up tx relay / mempool sync self.noban_tx_relay = True + self.supports_cli = False self.extra_args = [ ["-walletrbf=1"], ["-walletrbf=1"]