mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 06:49:38 -04:00
Compare commits
11 commits
f78c83253e
...
e0ed0638a3
Author | SHA1 | Date | |
---|---|---|---|
|
e0ed0638a3 | ||
|
c5e44a0435 | ||
|
32d55e28af | ||
|
bf4e919811 | ||
|
ac33a79b77 | ||
|
8f26c9ecaf | ||
|
31ddbe34dd | ||
|
abcec01ed5 | ||
|
75b58471db | ||
|
4829c414dc | ||
|
94d3b86def |
30 changed files with 81 additions and 55 deletions
|
@ -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
|
||||
|
|
|
@ -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"])
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -148,6 +148,7 @@ class EstimateFeeTest(BitcoinTestFramework):
|
|||
["-blockmaxweight=68000"],
|
||||
["-blockmaxweight=32000"],
|
||||
]
|
||||
self.supports_cli = False
|
||||
|
||||
def setup_network(self):
|
||||
"""
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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 )")
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"]
|
||||
|
|
Loading…
Add table
Reference in a new issue