mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge #14180: qa: Run all tests even if wallet is not compiled
fac95398366f644911b58f1605e6bc37fb76782d qa: Run all tests even if wallet is not compiled (MarcoFalke) faa669cbcd1fc799517b523b0f850e01b11bf40a qa: Premine to deterministic address with -disablewallet (MarcoFalke) Pull request description: Currently the test_runner would exit if the wallet was not compiled into the Bitcoin Core executable. However, a lot of the tests run without the wallet just fine and there is no need to globally require the wallet to run the tests. Tree-SHA512: 63177260aa29126fd20f0be217a82b10b62288ab846f96f1cbcc3bd2c52702437703475d91eae3f8d821a3149fc62b725a4c5b2a7b3657b67ffcbc81532a03bb
This commit is contained in:
parent
bcbaa00363
commit
71b4cf307b
@ -67,10 +67,11 @@ def custom_function():
|
||||
# self.log.info("running custom_function") # Oops! Can't run self.log outside the BitcoinTestFramework
|
||||
pass
|
||||
|
||||
|
||||
class ExampleTest(BitcoinTestFramework):
|
||||
# Each functional test is a subclass of the BitcoinTestFramework class.
|
||||
|
||||
# Override the set_test_params(), add_options(), setup_chain(), setup_network()
|
||||
# Override the set_test_params(), skip_test_if_missing_module(), add_options(), setup_chain(), setup_network()
|
||||
# and setup_nodes() methods to customize the test setup as required.
|
||||
|
||||
def set_test_params(self):
|
||||
@ -84,6 +85,9 @@ class ExampleTest(BitcoinTestFramework):
|
||||
|
||||
# self.log.info("I've finished set_test_params") # Oops! Can't run self.log before run_test()
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
# Use add_options() to add specific command-line options for your test.
|
||||
# In practice this is not used very much, since the tests are mostly written
|
||||
# to be run in automated environments without command-line options.
|
||||
|
@ -21,6 +21,9 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 4
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.add_nodes(self.num_nodes)
|
||||
# Nodes 0/1 are "wallet" nodes
|
||||
|
@ -23,6 +23,9 @@ class BIP68Test(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.extra_args = [[], ["-acceptnonstdtxn=0"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"]
|
||||
|
||||
|
@ -79,6 +79,9 @@ class FullBlockTest(BitcoinTestFramework):
|
||||
self.add_nodes(self.num_nodes, self.extra_args)
|
||||
self.start_nodes()
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
node = self.nodes[0] # convenience reference to the node
|
||||
|
||||
|
@ -16,6 +16,9 @@ class BlocksdirTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.stop_node(0)
|
||||
assert os.path.isdir(os.path.join(self.nodes[0].datadir, "regtest", "blocks"))
|
||||
|
@ -75,6 +75,9 @@ class BIP65Test(BitcoinTestFramework):
|
||||
},
|
||||
)
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.nodes[0].add_p2p_connection(P2PInterface())
|
||||
|
||||
|
@ -14,6 +14,9 @@ class ConfArgsTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def test_config_file_parser(self):
|
||||
# Assume node is stopped
|
||||
|
||||
|
@ -150,6 +150,9 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
||||
def setup_network(self):
|
||||
self.setup_nodes()
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def generate_blocks(self, number, version, test_blocks=None):
|
||||
if test_blocks is None:
|
||||
test_blocks = []
|
||||
|
@ -57,6 +57,9 @@ class ChainstateWriteCrashTest(BitcoinTestFramework):
|
||||
self.node3_args = []
|
||||
self.extra_args = [self.node0_args, self.node1_args, self.node2_args, self.node3_args]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.add_nodes(self.num_nodes, extra_args=self.extra_args)
|
||||
self.start_nodes()
|
||||
|
@ -62,6 +62,9 @@ class BIP66Test(BitcoinTestFramework):
|
||||
},
|
||||
)
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.nodes[0].add_p2p_connection(P2PInterface())
|
||||
|
||||
|
@ -20,6 +20,9 @@ class DIP0020ActivationTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.node = self.nodes[0]
|
||||
self.relayfee = satoshi_round(self.nodes[0].getnetworkinfo()["relayfee"])
|
||||
|
@ -28,6 +28,9 @@ class DIP3Test(BitcoinTestFramework):
|
||||
self.extra_args += ["-dip3params=135:150"]
|
||||
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.disable_mocktime()
|
||||
self.add_nodes(1)
|
||||
|
@ -124,6 +124,9 @@ class EstimateFeeTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 3
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
"""
|
||||
We'll setup the network to have 3 nodes that all mine with different parameters.
|
||||
|
@ -15,6 +15,9 @@ class LoggingTest(BitcoinTestFramework):
|
||||
self.num_nodes = 1
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def relative_log_path(self, name):
|
||||
return os.path.join(self.nodes[0].datadir, self.chain, name)
|
||||
|
||||
|
@ -40,6 +40,9 @@ class MaxUploadTest(BitcoinTestFramework):
|
||||
# Cache for utxos, as the listunspent may take a long time later in the test
|
||||
self.utxo_cache = []
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Advance all nodes 2 weeks in the future
|
||||
old_mocktime = self.mocktime
|
||||
|
@ -31,6 +31,9 @@ class MinimumChainWorkTest(BitcoinTestFramework):
|
||||
self.extra_args = [[], ["-minimumchainwork=0x65"], ["-minimumchainwork=0x65"]]
|
||||
self.node_min_work = [0, 101, 101]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
# Force CanDirectFetch to return false (otherwise nMinimumChainWork is ignored)
|
||||
self.bump_mocktime(21 * 2.6 * 60)
|
||||
|
@ -13,6 +13,9 @@ class NotificationsTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.alertnotify_dir = os.path.join(self.options.tmpdir, "alertnotify")
|
||||
self.blocknotify_dir = os.path.join(self.options.tmpdir, "blocknotify")
|
||||
|
@ -41,9 +41,12 @@ class NULLDUMMYTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.extra_args = [['-whitelist=127.0.0.1']]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.address = self.nodes[0].getnewaddress()
|
||||
self.ms_address = self.nodes[0].addmultisigaddress(1,[self.address])['address']
|
||||
self.ms_address = self.nodes[0].addmultisigaddress(1, [self.address])['address']
|
||||
|
||||
self.coinbase_blocks = self.nodes[0].generate(2) # Block 2
|
||||
coinbase_txid = []
|
||||
|
@ -33,15 +33,20 @@ class PruneTest(BitcoinTestFramework):
|
||||
|
||||
# Create nodes 0 and 1 to mine.
|
||||
# Create node 2 to test pruning.
|
||||
self.full_node_default_args = ["-dip3params=2000:2000", "-dip8params=2000", "-maxreceivebuffer=20000","-blockmaxsize=999000", "-checkblocks=5", "-limitdescendantcount=100", "-limitdescendantsize=5000", "-limitancestorcount=100", "-limitancestorsize=5000" ]
|
||||
self.full_node_default_args = ["-dip3params=2000:2000", "-dip8params=2000", "-maxreceivebuffer=20000","-blockmaxsize=999000", "-checkblocks=5", "-limitdescendantcount=100", "-limitdescendantsize=5000", "-limitancestorcount=100", "-limitancestorsize=5000"]
|
||||
# Create nodes 3 and 4 to test manual pruning (they will be re-started with manual pruning later)
|
||||
# Create nodes 5 to test wallet in prune mode, but do not connect
|
||||
self.extra_args = [self.full_node_default_args,
|
||||
self.full_node_default_args,
|
||||
["-dip3params=2000:2000", "-dip8params=2000", "-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-prune=550"],
|
||||
["-dip3params=2000:2000", "-dip8params=2000", "-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"],
|
||||
["-dip3params=2000:2000", "-dip8params=2000", "-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"],
|
||||
["-dip3params=2000:2000", "-dip8params=2000", "-disablegovernance","-txindex=0","-prune=550"]]
|
||||
self.extra_args = [
|
||||
self.full_node_default_args,
|
||||
self.full_node_default_args,
|
||||
["-dip3params=2000:2000", "-dip8params=2000", "-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-prune=550"],
|
||||
["-dip3params=2000:2000", "-dip8params=2000", "-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"],
|
||||
["-dip3params=2000:2000", "-dip8params=2000", "-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"],
|
||||
["-dip3params=2000:2000", "-dip8params=2000", "-disablegovernance","-txindex=0","-prune=550"],
|
||||
]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.setup_nodes()
|
||||
|
@ -18,6 +18,9 @@ class ReindexTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def reindex(self, justchainstate=False):
|
||||
self.nodes[0].generate(3)
|
||||
blockcount = self.nodes[0].getblockcount()
|
||||
|
@ -23,6 +23,9 @@ class SpentIndexTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 4
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.add_nodes(self.num_nodes)
|
||||
# Nodes 0/1 are "wallet" nodes
|
||||
|
@ -21,6 +21,9 @@ class TxIndexTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 4
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.add_nodes(self.num_nodes)
|
||||
# Nodes 0/1 are "wallet" nodes
|
||||
|
@ -30,6 +30,9 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
|
||||
# Open and close to create zero-length file
|
||||
|
@ -12,6 +12,9 @@ class TestBitcoinCli(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
"""Main test logic"""
|
||||
|
||||
|
@ -43,6 +43,9 @@ class RESTTest (BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.extra_args = [["-rest"], []]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def test_rest_request(self, uri, http_method='GET', req_type=ReqType.JSON, body='', status=200, ret_type=RetType.JSON):
|
||||
rest_uri = '/rest' + uri
|
||||
if req_type == ReqType.JSON:
|
||||
|
@ -7,18 +7,19 @@ import struct
|
||||
|
||||
from codecs import encode
|
||||
|
||||
from test_framework.test_framework import (
|
||||
BitcoinTestFramework, skip_if_no_bitcoind_zmq, skip_if_no_py3_zmq)
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.messages import dashhash
|
||||
from test_framework.util import (assert_equal,
|
||||
hash256,
|
||||
)
|
||||
from test_framework.util import (
|
||||
assert_equal,
|
||||
hash256,
|
||||
)
|
||||
|
||||
ADDRESS = "tcp://127.0.0.1:28332"
|
||||
|
||||
def dashhash_helper(b):
|
||||
return encode(dashhash(b)[::-1], 'hex_codec').decode('ascii')
|
||||
|
||||
|
||||
class ZMQSubscriber:
|
||||
def __init__(self, socket, topic):
|
||||
self.sequence = 0
|
||||
@ -42,10 +43,12 @@ class ZMQTest (BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
|
||||
def setup_nodes(self):
|
||||
skip_if_no_py3_zmq()
|
||||
skip_if_no_bitcoind_zmq(self)
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_py3_zmq()
|
||||
self.skip_if_no_bitcoind_zmq()
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_nodes(self):
|
||||
import zmq
|
||||
|
||||
# Initialize ZMQ context and socket.
|
||||
@ -66,7 +69,7 @@ class ZMQTest (BitcoinTestFramework):
|
||||
|
||||
self.extra_args = [
|
||||
["-zmqpub%s=%s" % (sub.topic.decode(), ADDRESS) for sub in [self.hashblock, self.hashtx, self.rawblock, self.rawtx]],
|
||||
[],
|
||||
[]
|
||||
]
|
||||
self.add_nodes(self.num_nodes, self.extra_args)
|
||||
self.start_nodes()
|
||||
|
@ -16,8 +16,7 @@ try:
|
||||
finally:
|
||||
pass
|
||||
|
||||
from test_framework.test_framework import (
|
||||
DashTestFramework, skip_if_no_bitcoind_zmq, skip_if_no_py3_zmq)
|
||||
from test_framework.test_framework import DashTestFramework
|
||||
from test_framework.mininode import P2PInterface
|
||||
from test_framework.util import assert_equal, assert_raises_rpc_error
|
||||
from test_framework.messages import (
|
||||
@ -96,14 +95,16 @@ class DashZMQTest (DashTestFramework):
|
||||
|
||||
self.set_dash_test_params(4, 3, fast_dip3_enforcement=True, extra_args=[node0_extra_args, [], [], []])
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_py3_zmq()
|
||||
self.skip_if_no_bitcoind_zmq()
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Check that dashd has been built with ZMQ enabled.
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(self.options.configfile))
|
||||
|
||||
skip_if_no_py3_zmq()
|
||||
skip_if_no_bitcoind_zmq(self)
|
||||
|
||||
try:
|
||||
# Setup the ZMQ subscriber socket
|
||||
self.zmq_context = zmq.Context()
|
||||
|
@ -41,6 +41,9 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
'-acceptnonstdtxn=0', # Try to mimic main-net
|
||||
]] * self.num_nodes
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def check_mempool_result(self, result_expected, *args, **kwargs):
|
||||
"""Wrapper to check result of testmempoolaccept on node_0's mempool"""
|
||||
result_test = self.nodes[0].testmempoolaccept(*args, **kwargs)
|
||||
|
@ -27,9 +27,8 @@ class MempoolExpiryTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
|
||||
# TODO: enable when skip_if_no_wallet is backported
|
||||
# def skip_test_if_missing_module(self):
|
||||
# self.skip_if_no_wallet()
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def test_transaction_expiry(self, timeout):
|
||||
"""Tests that a transaction expires after the expiry timeout and its
|
||||
|
@ -15,6 +15,9 @@ class MempoolLimitTest(BitcoinTestFramework):
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [["-maxmempool=5", "-spendzeroconfchange=0"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
txouts = gen_return_txouts()
|
||||
relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||
|
@ -18,6 +18,9 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.extra_args = [["-maxorphantxsize=1000"], ["-maxorphantxsize=1000", "-limitancestorcount=5"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
# Build a transaction that spends parent_txid:vout
|
||||
# Return amount sent
|
||||
def chain_transaction(self, node, parent_txid, vout, value, fee, num_outputs):
|
||||
|
@ -48,6 +48,9 @@ class MempoolPersistTest(BitcoinTestFramework):
|
||||
self.num_nodes = 3
|
||||
self.extra_args = [[], ["-persistmempool=0"], []]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
chain_height = self.nodes[0].getblockcount()
|
||||
assert_equal(chain_height, 200)
|
||||
|
@ -17,6 +17,9 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
alert_filename = None # Set by setup_network
|
||||
|
||||
def run_test(self):
|
||||
|
@ -13,6 +13,9 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
node0_address = self.nodes[0].getnewaddress()
|
||||
# Spend block 1/2/3's coinbase transactions
|
||||
|
@ -23,6 +23,9 @@ class MempoolSpendCoinbaseTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
chain_height = self.nodes[0].getblockcount()
|
||||
assert_equal(chain_height, 200)
|
||||
|
@ -39,6 +39,9 @@ class MiningTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.setup_clean_chain = False
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
node = self.nodes[0]
|
||||
|
||||
|
@ -28,6 +28,9 @@ class GetBlockTemplateLPTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.log.info("Warning: this test will take about 70 seconds in the best case. Be patient.")
|
||||
self.nodes[0].generate(10)
|
||||
|
@ -14,6 +14,9 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.extra_args = [["-printpriority=1"]] * 2
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Test `prioritisetransaction` required parameters
|
||||
assert_raises_rpc_error(-1, "prioritisetransaction", self.nodes[0].prioritisetransaction)
|
||||
|
@ -96,6 +96,9 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
self.extra_args = [["-txindex"]] * 2
|
||||
self.utxos = []
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def build_block_on_tip(self, node):
|
||||
height = node.getblockcount()
|
||||
tip = node.getbestblockhash()
|
||||
|
@ -30,6 +30,9 @@ class P2PFingerprintTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
# Build a chain of blocks on top of given one
|
||||
def build_chain(self, nblocks, prev_hash, prev_height, prev_median_time):
|
||||
blocks = []
|
||||
|
@ -25,6 +25,9 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.extra_args = [["-whitelist=127.0.0.1"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Add p2p connection to node0
|
||||
node = self.nodes[0] # convenience reference to the node
|
||||
|
@ -15,6 +15,9 @@ class InvalidLocatorTest(BitcoinTestFramework):
|
||||
self.num_nodes = 1
|
||||
self.setup_clean_chain = False
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
node = self.nodes[0] # convenience reference to the node
|
||||
node.generate(1) # Get node out of IBD
|
||||
|
@ -28,6 +28,9 @@ class InvalidTxRequestTest(BitcoinTestFramework):
|
||||
self.num_nodes = 1
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def bootstrap_p2p(self, *, num_connections=1):
|
||||
"""Add a P2P connection to the node.
|
||||
|
||||
|
@ -110,6 +110,9 @@ class P2PLeakTest(BitcoinTestFramework):
|
||||
self.disable_mocktime()
|
||||
self.setup_nodes()
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
no_version_bannode = self.nodes[0].add_p2p_connection(CNodeNoVersionBan(), send_version=False, wait_for_verack=False)
|
||||
no_version_idlenode = self.nodes[0].add_p2p_connection(CNodeNoVersionIdle(), send_version=False, wait_for_verack=False)
|
||||
|
@ -21,9 +21,8 @@ class P2PLeakTxTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
|
||||
# TODO: enable when skip_if_no_wallet is backported
|
||||
# def skip_test_if_missing_module(self):
|
||||
# self.skip_if_no_wallet()
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
gen_node = self.nodes[0] # The block and tx generating node
|
||||
|
@ -34,6 +34,9 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
|
||||
self.num_nodes = 3
|
||||
self.extra_args = [['-prune=550', '-txindex=0', '-addrmantest'], [], []]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def disconnect_all(self):
|
||||
disconnect_nodes(self.nodes[0], 1)
|
||||
disconnect_nodes(self.nodes[1], 0)
|
||||
|
@ -206,6 +206,9 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 2
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def mine_blocks(self, count):
|
||||
"""Mine count blocks and return the new tip."""
|
||||
|
||||
|
@ -65,6 +65,9 @@ class AcceptBlockTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.extra_args = [[], ["-minimumchainwork=0x10"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
# Node0 will be used to test behavior of processing unrequested blocks
|
||||
# from peers which are not whitelisted, while Node1 will be used for
|
||||
|
@ -49,16 +49,11 @@ from test_framework.mininode import (
|
||||
class BlockchainTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Have to prepare the chain manually here.
|
||||
# txindex=1 by default in Dash which is incompatible with pruning.
|
||||
self.set_genesis_mocktime()
|
||||
for i in range(200):
|
||||
self.bump_mocktime(156)
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
self.restart_node(0, extra_args=['-stopatheight=207', '-prune=1', '-txindex=0']) # Set extra args with pruning after rescan is complete
|
||||
|
||||
# Actual tests
|
||||
@ -183,7 +178,7 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
assert_equal(res['transactions'], 200)
|
||||
assert_equal(res['height'], 200)
|
||||
assert_equal(res['txouts'], 200)
|
||||
assert_equal(res['bogosize'], 17000),
|
||||
assert_equal(res['bogosize'], 15000),
|
||||
size = res['disk_size']
|
||||
assert size > 6400
|
||||
assert size < 64000
|
||||
|
@ -16,6 +16,9 @@ class CoinJoinTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.test_coinjoin_start_stop()
|
||||
self.test_coinjoin_setamount()
|
||||
|
@ -30,6 +30,9 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.extra_args = [['-usehd=0']] * self.num_nodes
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.setup_nodes()
|
||||
|
||||
|
@ -17,6 +17,9 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
self.num_nodes = 4
|
||||
self.extra_args = [['-usehd=1']] * self.num_nodes
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
super().setup_network()
|
||||
connect_nodes_bi(self.nodes,0,1)
|
||||
|
@ -17,15 +17,18 @@ class GetChainTipsTest (BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 4
|
||||
|
||||
def run_test (self):
|
||||
tips = self.nodes[0].getchaintips ()
|
||||
assert_equal (len (tips), 1)
|
||||
assert_equal (tips[0]['branchlen'], 0)
|
||||
assert_equal (tips[0]['height'], 200)
|
||||
assert_equal (tips[0]['status'], 'active')
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
tips = self.nodes[0].getchaintips()
|
||||
assert_equal(len(tips), 1)
|
||||
assert_equal(tips[0]['branchlen'], 0)
|
||||
assert_equal(tips[0]['height'], 200)
|
||||
assert_equal(tips[0]['status'], 'active')
|
||||
|
||||
# Split the network and build two chains of different lengths.
|
||||
self.split_network ()
|
||||
self.split_network()
|
||||
self.nodes[0].generate(10)
|
||||
self.nodes[2].generate(20)
|
||||
self.sync_all(self.nodes[:2])
|
||||
|
@ -4,7 +4,7 @@
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test RPC help output."""
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework, is_zmq_enabled
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal, assert_raises_rpc_error
|
||||
|
||||
import os
|
||||
@ -33,9 +33,12 @@ class HelpRpcTest(BitcoinTestFramework):
|
||||
# command titles
|
||||
titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')]
|
||||
|
||||
components = ['Addressindex', 'Blockchain', 'Control', 'Dash', 'Evo', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util', 'Wallet']
|
||||
components = ['Addressindex', 'Blockchain', 'Control', 'Dash', 'Evo', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util']
|
||||
|
||||
if is_zmq_enabled(self):
|
||||
if self.is_wallet_compiled():
|
||||
components.append('Wallet')
|
||||
|
||||
if self.is_zmq_compiled():
|
||||
components.append('Zmq')
|
||||
|
||||
assert_equal(titles, components)
|
||||
|
@ -14,6 +14,9 @@ class InvalidateTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 3
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.setup_nodes()
|
||||
|
||||
|
@ -38,6 +38,9 @@ class PreciousTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 3
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.setup_nodes()
|
||||
|
||||
|
@ -19,6 +19,9 @@ class PSBTTest(BitcoinTestFramework):
|
||||
# TODO: remove -txindex. Currently required for getrawtransaction call.
|
||||
self.extra_args = [[], ["-txindex"], ["-txindex"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Create and fund a raw tx for sending 10 BTC
|
||||
psbtx1 = self.nodes[0].walletcreatefundedpsbt([], {self.nodes[2].getnewaddress():10})['psbt']
|
||||
|
@ -44,6 +44,9 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
self.num_nodes = 3
|
||||
self.extra_args = [["-txindex"], ["-txindex"], ["-txindex"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
super().setup_network()
|
||||
connect_nodes_bi(self.nodes, 0, 2)
|
||||
|
@ -13,6 +13,10 @@ class ScantxoutsetTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.log.info("Mining blocks...")
|
||||
self.nodes[0].generate(110)
|
||||
|
@ -12,6 +12,9 @@ class SignMessagesTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
message = 'This is just a test message'
|
||||
|
||||
|
@ -14,6 +14,9 @@ class SignRawTransactionsTest(BitcoinTestFramework):
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [["-deprecatedrpc=signrawtransaction"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def successful_signing_test(self):
|
||||
"""Create and sign a valid raw transaction with one input.
|
||||
|
||||
|
@ -17,6 +17,9 @@ class MerkleBlockTest(BitcoinTestFramework):
|
||||
# Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing
|
||||
self.extra_args = [[], [], [], ["-txindex"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.setup_nodes()
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
|
@ -65,6 +65,13 @@ TEST_EXIT_SKIPPED = 77
|
||||
|
||||
GENESISTIME = 1417713337
|
||||
|
||||
class SkipTest(Exception):
|
||||
"""This exception is raised to skip a test"""
|
||||
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
|
||||
|
||||
class BitcoinTestMetaClass(type):
|
||||
"""Metaclass for BitcoinTestFramework.
|
||||
|
||||
@ -210,6 +217,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
try:
|
||||
if self.options.usecli and not self.supports_cli:
|
||||
raise SkipTest("--usecli specified but test does not support using CLI")
|
||||
self.skip_test_if_missing_module()
|
||||
self.setup_chain()
|
||||
self.setup_network()
|
||||
self.import_deterministic_coinbase_privkeys()
|
||||
@ -288,6 +296,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
"""Override this method to add command-line options to the test"""
|
||||
pass
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
"""Override this method to skip a test if a module is not compiled"""
|
||||
pass
|
||||
|
||||
def setup_chain(self):
|
||||
"""Override this method to customize blockchain setup"""
|
||||
self.log.info("Initializing test directory " + self.options.tmpdir)
|
||||
@ -582,6 +594,50 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
for i in range(self.num_nodes):
|
||||
initialize_datadir(self.options.tmpdir, i, self.chain)
|
||||
|
||||
def skip_if_no_py3_zmq(self):
|
||||
"""Attempt to import the zmq package and skip the test if the import fails."""
|
||||
try:
|
||||
import zmq # noqa
|
||||
except ImportError:
|
||||
raise SkipTest("python3-zmq module not available.")
|
||||
|
||||
def skip_if_no_bitcoind_zmq(self):
|
||||
"""Skip the running test if dashd has not been compiled with zmq support."""
|
||||
if not self.is_zmq_compiled():
|
||||
raise SkipTest("dashd has not been built with zmq enabled.")
|
||||
|
||||
def skip_if_no_wallet(self):
|
||||
"""Skip the running test if wallet has not been compiled."""
|
||||
if not self.is_wallet_compiled():
|
||||
raise SkipTest("wallet has not been compiled.")
|
||||
|
||||
def skip_if_no_cli(self):
|
||||
"""Skip the running test if dash-cli has not been compiled."""
|
||||
if not self.is_cli_compiled():
|
||||
raise SkipTest("dash-cli has not been compiled.")
|
||||
|
||||
def is_cli_compiled(self):
|
||||
"""Checks whether dash-cli was compiled."""
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(self.options.configfile))
|
||||
|
||||
return config["components"].getboolean("ENABLE_UTILS")
|
||||
|
||||
def is_wallet_compiled(self):
|
||||
"""Checks whether the wallet module was compiled."""
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(self.options.configfile))
|
||||
|
||||
return config["components"].getboolean("ENABLE_WALLET")
|
||||
|
||||
def is_zmq_compiled(self):
|
||||
"""Checks whether the zmq module was compiled."""
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(self.options.configfile))
|
||||
|
||||
return config["components"].getboolean("ENABLE_ZMQ")
|
||||
|
||||
|
||||
MASTERNODE_COLLATERAL = 1000
|
||||
|
||||
|
||||
@ -602,6 +658,9 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
"""Tests must this method to change default values for number of nodes, topology, etc"""
|
||||
raise NotImplementedError
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
"""Tests must override this method to define test logic"""
|
||||
raise NotImplementedError
|
||||
@ -1217,31 +1276,3 @@ class DashTestFramework(BitcoinTestFramework):
|
||||
c += 1
|
||||
return c >= count
|
||||
wait_until(test, timeout=timeout)
|
||||
|
||||
|
||||
class SkipTest(Exception):
|
||||
"""This exception is raised to skip a test"""
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
|
||||
|
||||
def skip_if_no_py3_zmq():
|
||||
"""Attempt to import the zmq package and skip the test if the import fails."""
|
||||
try:
|
||||
import zmq # noqa
|
||||
except ImportError:
|
||||
raise SkipTest("python3-zmq module not available.")
|
||||
|
||||
|
||||
def skip_if_no_bitcoind_zmq(test_instance):
|
||||
"""Skip the running test if dashd has not been compiled with zmq support."""
|
||||
if not is_zmq_enabled(test_instance):
|
||||
raise SkipTest("dashd has not been built with zmq enabled.")
|
||||
|
||||
|
||||
def is_zmq_enabled(test_instance):
|
||||
"""Checks whether zmq is enabled or not."""
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(test_instance.options.configfile))
|
||||
|
||||
return config["components"].getboolean("ENABLE_ZMQ")
|
||||
|
@ -285,13 +285,11 @@ def main():
|
||||
|
||||
logging.debug("Temporary test directory at %s" % tmpdir)
|
||||
|
||||
enable_wallet = config["components"].getboolean("ENABLE_WALLET")
|
||||
enable_utils = config["components"].getboolean("ENABLE_UTILS")
|
||||
enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
|
||||
|
||||
if not (enable_wallet and enable_utils and enable_bitcoind):
|
||||
print("No functional tests to run. Wallet, utils, and dashd must all be enabled")
|
||||
print("Rerun `configure` with -enable-wallet, -with-utils and -with-daemon and rerun make")
|
||||
if not enable_bitcoind:
|
||||
print("No functional tests to run.")
|
||||
print("Rerun ./configure with --with-daemon and then make")
|
||||
sys.exit(0)
|
||||
|
||||
# Build list of tests
|
||||
|
@ -26,6 +26,9 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.extra_args = [["-minrelaytxfee=0.00001"], []]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.nodes[1].generate(100)
|
||||
self.sync_blocks()
|
||||
|
@ -45,6 +45,9 @@ class WalletBackupTest(BitcoinTestFramework):
|
||||
# nodes 1, 2,3 are spenders, let's give them a keypool=100
|
||||
self.extra_args = [["-keypool=100"], ["-keypool=100"], ["-keypool=100"], []]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.setup_nodes()
|
||||
connect_nodes(self.nodes[0], 3)
|
||||
|
@ -24,6 +24,9 @@ class WalletTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.extra_args = [['-usehd={:d}'.format(i%2==0)] for i in range(4)]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.add_nodes(4, self.extra_args)
|
||||
self.start_node(0)
|
||||
|
@ -18,6 +18,9 @@ class DisablePrivateKeysTest(BitcoinTestFramework):
|
||||
self.num_nodes = 1
|
||||
self.supports_cli = True
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
node = self.nodes[0]
|
||||
self.log.info("Test disableprivatekeys creation.")
|
||||
|
@ -83,6 +83,9 @@ class WalletDumpTest(BitcoinTestFramework):
|
||||
self.extra_args = [["-keypool=90", "-usehd=1"]]
|
||||
self.rpc_timeout = 120
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
# TODO remove this when usehd=1 becomes the default
|
||||
# use our own cache and -usehd=1 as extra arg as the default cache is run with -usehd=0
|
||||
|
@ -19,6 +19,9 @@ class WalletEncryptionTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
passphrase = "WalletPassphrase"
|
||||
passphrase2 = "SecondWalletPassphrase"
|
||||
|
@ -23,7 +23,10 @@ class WalletGroupTest(BitcoinTestFramework):
|
||||
self.extra_args = [[], [], ['-avoidpartialspends']]
|
||||
self.rpc_timeout = 120
|
||||
|
||||
def run_test (self):
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Mine some coins
|
||||
self.nodes[0].generate(110)
|
||||
|
||||
|
@ -23,6 +23,9 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
self.add_nodes(self.num_nodes, self.extra_args)
|
||||
self.start_nodes()
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Make sure can't switch off usehd after wallet creation
|
||||
self.stop_node(1)
|
||||
|
@ -123,6 +123,9 @@ class ImportRescanTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2 + len(IMPORT_NODES)
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
extra_args = [[] for _ in range(self.num_nodes)]
|
||||
for i, import_node in enumerate(IMPORT_NODES, 2):
|
||||
|
@ -18,6 +18,9 @@ class ImportMultiTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.setup_nodes()
|
||||
|
||||
|
@ -16,6 +16,9 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 2
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.log.info("Mining blocks...")
|
||||
self.nodes[0].generate(101)
|
||||
|
@ -14,6 +14,9 @@ class KeyPoolTest(BitcoinTestFramework):
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [['-usehd=0']]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
nodes = self.nodes
|
||||
|
||||
|
@ -20,6 +20,9 @@ class KeyPoolTest(BitcoinTestFramework):
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [['-usehd=1']]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
nodes = self.nodes
|
||||
addr_before_encrypting = nodes[0].getnewaddress()
|
||||
|
@ -26,6 +26,9 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=100']]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
wallet_path = os.path.join(self.nodes[1].datadir, self.chain, "wallets", "wallet.dat")
|
||||
wallet_backup_path = os.path.join(self.nodes[1].datadir, "wallet.bak")
|
||||
|
@ -26,6 +26,9 @@ class WalletLabelsTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.extra_args = [['-deprecatedrpc=accounts', "-paytxfee=0.0001"], ["-paytxfee=0.0001"]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
"""Run the test twice - once using the accounts API and once using the labels API."""
|
||||
self.log.info("Test accounts API")
|
||||
|
@ -23,6 +23,9 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||
super().import_deterministic_coinbase_privkeys()
|
||||
self.num_cb_reward_addresses = len(self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True))
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Generate block to get out of IBD
|
||||
self.nodes[0].generate(1)
|
||||
|
@ -12,6 +12,9 @@ class ListSinceBlockTest (BitcoinTestFramework):
|
||||
self.num_nodes = 4
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.nodes[2].generate(101)
|
||||
self.sync_all()
|
||||
|
@ -13,6 +13,9 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.set_cache_mocktime()
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Simple send, 0 to 1:
|
||||
txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1)
|
||||
|
@ -24,6 +24,9 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
self.supports_cli = True
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
node = self.nodes[0]
|
||||
|
||||
|
@ -12,6 +12,9 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [['--walletbroadcast=false']]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
# Should raise RPC_WALLET_ERROR (-4) if walletbroadcast is disabled.
|
||||
assert_raises_rpc_error(-4, "Error: Wallet transaction broadcasting is disabled with -walletbroadcast", self.nodes[0].resendwallettransactions)
|
||||
|
@ -17,6 +17,9 @@ class TxnMallTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 4
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def add_options(self, parser):
|
||||
parser.add_argument("--mineblock", dest="mine_block", default=False, action="store_true",
|
||||
help="Test double-spend of 1-confirmed transaction")
|
||||
|
@ -17,6 +17,9 @@ class TxnMallTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 4
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def add_options(self, parser):
|
||||
parser.add_argument("--mineblock", dest="mine_block", default=False, action="store_true",
|
||||
help="Test double-spend of 1-confirmed transaction")
|
||||
|
@ -22,6 +22,9 @@ class WalletUpgradeToHDTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def setup_network(self):
|
||||
self.add_nodes(self.num_nodes)
|
||||
self.start_nodes()
|
||||
|
@ -26,6 +26,9 @@ class ZapWalletTXesTest (BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 2
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def run_test(self):
|
||||
self.log.info("Mining blocks...")
|
||||
self.nodes[0].generate(1)
|
||||
|
Loading…
Reference in New Issue
Block a user