Compare commits

...

11 commits

Author SHA1 Message Date
Martin Zumsande
e0ed0638a3
Merge bf4e919811 into c5e44a0435 2025-04-29 11:51:51 +02:00
merge-script
c5e44a0435
Merge bitcoin/bitcoin#32369: test: Use the correct node for doubled keypath test
Some checks are pending
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Windows native, VS 2022 (push) Waiting to run
CI / Windows native, fuzz, VS 2022 (push) Waiting to run
CI / Linux->Windows cross, no tests (push) Waiting to run
CI / Windows, test cross-built (push) Blocked by required conditions
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
32d55e28af test: Use the correct node for doubled keypath test (Ava Chow)

Pull request description:

  #29124 had a silent merge conflict with #32350 which resulted in it using the wrong node. Fix the test to use the correct v22 node.

ACKs for top commit:
  maflcko:
    lgtm ACK 32d55e28af
  rkrux:
    ACK 32d55e28af
  BrandonOdiwuor:
    Code Review ACK 32d55e28af

Tree-SHA512: 1e0231985beb382b16e1d608c874750423d0502388db0c8ad450b22d17f9d96f5e16a6b44948ebda5efc750f62b60d0de8dd20131f449427426a36caf374af92
2025-04-29 09:59:42 +01:00
Ava Chow
32d55e28af test: Use the correct node for doubled keypath test 2025-04-28 14:44:17 -07:00
Martin Zumsande
bf4e919811 test: Disable tests for cli that make large RPC calls
These tests send off large rpc calls (e.g.by submitting large txns or blocks)
that exceed the limit of execve (128kb on many systems) when using cli.
2025-04-25 11:24:55 -04:00
Martin Zumsande
ac33a79b77 test: Disable several (sub)tests with cli
Reason for each test:
wallet_labels.py: uses createmultiwallet, which is currently not
compatible with cli
rpc_whitelist.py: Relies on direct RPC calls
wallet_encryption.py: Null characters cannot be passed to
suprocess.Popen, which is used to send the commands to
bitcoin-cli.
2025-04-25 11:24:55 -04:00
Martin Zumsande
8f26c9ecaf test: skip subtests that check for wrong types with cli
The error messages returned for wrong type differ betwen
using rpc or cli - skip these subtests where they happen.
2025-04-25 11:24:53 -04:00
Martin Zumsande
31ddbe34dd test: add function to convert to json for height_or_hash params
This is necessary for bitcoin-cli because a string without quotes
is not a valid json.
2025-04-25 11:22:09 -04:00
Martin Zumsande
abcec01ed5 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.
2025-04-25 11:22:09 -04:00
Martin Zumsande
75b58471db test: convert tuple to json for cli
This makes it possible to run rpc_createmultisig.py with --usecli.
2025-04-25 11:22:06 -04:00
Martin Zumsande
4829c414dc test: make rpc_psbt.py usable with --usecli
The psbt string would include a "=" sign, which would
make the cli interpret this as a named argument.
Fix this by making it an actual named arg with the
correct name.
2025-04-25 11:21:21 -04:00
Martin Zumsande
94d3b86def test: fix rpc_deprecated.py to be usable with --usecli 2025-04-25 11:21:21 -04:00
30 changed files with 81 additions and 55 deletions

View file

@ -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

View file

@ -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"])

View file

@ -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")

View file

@ -148,6 +148,7 @@ class EstimateFeeTest(BitcoinTestFramework):
["-blockmaxweight=68000"],
["-blockmaxweight=32000"],
]
self.supports_cli = False
def setup_network(self):
"""

View file

@ -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")

View file

@ -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):

View file

@ -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)

View file

@ -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]

View file

@ -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")

View file

@ -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 = []

View file

@ -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()

View file

@ -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)

View file

@ -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()

View file

@ -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)

View file

@ -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')

View file

@ -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 )")

View file

@ -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')

View file

@ -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]

View file

@ -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

View file

@ -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):

View file

@ -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

View file

@ -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,

View file

@ -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

View file

@ -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()

View file

@ -87,7 +87,7 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
# 0.21.x and 22.x would both produce bad derivation paths when topping up an inactive hd chain
# Make sure that this is being automatically cleaned up by migration
node_master = self.nodes[1]
node_v22 = self.nodes[self.num_nodes - 5]
node_v22 = self.nodes[self.num_nodes - 3]
wallet_name = "bad_deriv_path"
node_v22.createwallet(wallet_name=wallet_name, descriptors=False)
bad_deriv_wallet = node_v22.get_wallet_rpc(wallet_name)

View file

@ -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)

View file

@ -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)

View file

@ -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()

View file

@ -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()

View file

@ -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"]