Merge #14180: qa: Run all tests even if wallet is not compiled

fac9539836 qa: Run all tests even if wallet is not compiled (MarcoFalke)
faa669cbcd 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:
Wladimir J. van der Laan 2018-09-13 12:33:15 +02:00
commit 288ddf4ff5
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
86 changed files with 497 additions and 128 deletions

View File

@ -67,10 +67,11 @@ def custom_function():
# self.log.info("running custom_function") # Oops! Can't run self.log outside the BitcoinTestFramework # self.log.info("running custom_function") # Oops! Can't run self.log outside the BitcoinTestFramework
pass pass
class ExampleTest(BitcoinTestFramework): class ExampleTest(BitcoinTestFramework):
# Each functional test is a subclass of the BitcoinTestFramework class. # 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. # and setup_nodes() methods to customize the test setup as required.
def set_test_params(self): 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() # 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. # 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 # In practice this is not used very much, since the tests are mostly written
# to be run in automated environments without command-line options. # to be run in automated environments without command-line options.

View File

@ -25,6 +25,9 @@ class BIP68Test(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.extra_args = [[], ["-acceptnonstdtxn=0"]] self.extra_args = [[], ["-acceptnonstdtxn=0"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"] self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"]

View File

@ -75,6 +75,9 @@ class FullBlockTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.extra_args = [[]] self.extra_args = [[]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
node = self.nodes[0] # convenience reference to the node node = self.nodes[0] # convenience reference to the node

View File

@ -16,6 +16,9 @@ class BlocksdirTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 1 self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.stop_node(0) self.stop_node(0)
shutil.rmtree(self.nodes[0].datadir) shutil.rmtree(self.nodes[0].datadir)

View File

@ -62,6 +62,9 @@ class BIP65Test(BitcoinTestFramework):
self.extra_args = [['-whitelist=127.0.0.1', '-par=1']] # Use only one script thread to get the exact reject reason for testing self.extra_args = [['-whitelist=127.0.0.1', '-par=1']] # Use only one script thread to get the exact reject reason for testing
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.nodes[0].add_p2p_connection(P2PInterface()) self.nodes[0].add_p2p_connection(P2PInterface())

View File

@ -14,6 +14,9 @@ class ConfArgsTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 1 self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def test_config_file_parser(self): def test_config_file_parser(self):
# Assume node is stopped # Assume node is stopped

View File

@ -145,6 +145,9 @@ class BIP68_112_113Test(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=4', '-addresstype=legacy']] self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=4', '-addresstype=legacy']]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def generate_blocks(self, number, version, test_blocks=None): def generate_blocks(self, number, version, test_blocks=None):
if test_blocks is None: if test_blocks is None:
test_blocks = [] test_blocks = []

View File

@ -63,6 +63,9 @@ class ChainstateWriteCrashTest(BitcoinTestFramework):
self.node3_args = ["-blockmaxweight=4000000"] self.node3_args = ["-blockmaxweight=4000000"]
self.extra_args = [self.node0_args, self.node1_args, self.node2_args, 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): def setup_network(self):
self.add_nodes(self.num_nodes, extra_args=self.extra_args) self.add_nodes(self.num_nodes, extra_args=self.extra_args)
self.start_nodes() self.start_nodes()

View File

@ -49,6 +49,9 @@ class BIP66Test(BitcoinTestFramework):
self.extra_args = [['-whitelist=127.0.0.1', '-par=1', '-enablebip61']] # Use only one script thread to get the exact reject reason for testing self.extra_args = [['-whitelist=127.0.0.1', '-par=1', '-enablebip61']] # Use only one script thread to get the exact reject reason for testing
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.nodes[0].add_p2p_connection(P2PInterface()) self.nodes[0].add_p2p_connection(P2PInterface())

View File

@ -126,6 +126,9 @@ class EstimateFeeTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 3 self.num_nodes = 3
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
""" """
We'll setup the network to have 3 nodes that all mine with different parameters. We'll setup the network to have 3 nodes that all mine with different parameters.
@ -168,6 +171,11 @@ class EstimateFeeTest(BitcoinTestFramework):
newmem.append(utx) newmem.append(utx)
self.memutxo = newmem self.memutxo = newmem
def import_deterministic_coinbase_privkeys(self):
self.start_nodes()
super().import_deterministic_coinbase_privkeys()
self.stop_nodes()
def run_test(self): def run_test(self):
self.log.info("This test is time consuming, please be patient") self.log.info("This test is time consuming, please be patient")
self.log.info("Splitting inputs so we can generate tx's") self.log.info("Splitting inputs so we can generate tx's")

View File

@ -15,6 +15,9 @@ class LoggingTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def relative_log_path(self, name): def relative_log_path(self, name):
return os.path.join(self.nodes[0].datadir, "regtest", name) return os.path.join(self.nodes[0].datadir, "regtest", name)

View File

@ -40,6 +40,9 @@ class MaxUploadTest(BitcoinTestFramework):
# Cache for utxos, as the listunspent may take a long time later in the test # Cache for utxos, as the listunspent may take a long time later in the test
self.utxo_cache = [] self.utxo_cache = []
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
# Before we connect anything, we first set the time on the node # Before we connect anything, we first set the time on the node
# to be in the past, otherwise things break because the CNode # to be in the past, otherwise things break because the CNode

View File

@ -31,6 +31,9 @@ class MinimumChainWorkTest(BitcoinTestFramework):
self.extra_args = [[], ["-minimumchainwork=0x65"], ["-minimumchainwork=0x65"]] self.extra_args = [[], ["-minimumchainwork=0x65"], ["-minimumchainwork=0x65"]]
self.node_min_work = [0, 101, 101] self.node_min_work = [0, 101, 101]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
# This test relies on the chain setup being: # This test relies on the chain setup being:
# node0 <- node1 <- node2 # node0 <- node1 <- node2

View File

@ -13,6 +13,9 @@ class NotificationsTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt") self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
self.block_filename = os.path.join(self.options.tmpdir, "blocks.txt") self.block_filename = os.path.join(self.options.tmpdir, "blocks.txt")

View File

@ -44,9 +44,12 @@ class NULLDUMMYTest(BitcoinTestFramework):
# normal segwit activation here (and don't use the default always-on behaviour). # normal segwit activation here (and don't use the default always-on behaviour).
self.extra_args = [['-whitelist=127.0.0.1', '-vbparams=segwit:0:999999999999', '-addresstype=legacy', "-deprecatedrpc=addwitnessaddress"]] self.extra_args = [['-whitelist=127.0.0.1', '-vbparams=segwit:0:999999999999', '-addresstype=legacy', "-deprecatedrpc=addwitnessaddress"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.address = self.nodes[0].getnewaddress() 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.wit_address = self.nodes[0].addwitnessaddress(self.address) self.wit_address = self.nodes[0].addwitnessaddress(self.address)
self.wit_ms_address = self.nodes[0].addmultisigaddress(1, [self.address], '', 'p2sh-segwit')['address'] self.wit_ms_address = self.nodes[0].addmultisigaddress(1, [self.address], '', 'p2sh-segwit')['address']

View File

@ -33,15 +33,20 @@ class PruneTest(BitcoinTestFramework):
# Create nodes 0 and 1 to mine. # Create nodes 0 and 1 to mine.
# Create node 2 to test pruning. # Create node 2 to test pruning.
self.full_node_default_args = ["-maxreceivebuffer=20000", "-checkblocks=5", "-limitdescendantcount=100", "-limitdescendantsize=5000", "-limitancestorcount=100", "-limitancestorsize=5000" ] self.full_node_default_args = ["-maxreceivebuffer=20000", "-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 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 # Create nodes 5 to test wallet in prune mode, but do not connect
self.extra_args = [self.full_node_default_args, self.extra_args = [
self.full_node_default_args,
self.full_node_default_args, self.full_node_default_args,
["-maxreceivebuffer=20000", "-prune=550"], ["-maxreceivebuffer=20000", "-prune=550"],
["-maxreceivebuffer=20000"], ["-maxreceivebuffer=20000"],
["-maxreceivebuffer=20000"], ["-maxreceivebuffer=20000"],
["-prune=550"]] ["-prune=550"],
]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
self.setup_nodes() self.setup_nodes()

View File

@ -61,17 +61,26 @@ def make_utxo(node, amount, confirmed=True, scriptPubKey=CScript([1])):
return COutPoint(int(txid, 16), 0) return COutPoint(int(txid, 16), 0)
class ReplaceByFeeTest(BitcoinTestFramework):
class ReplaceByFeeTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 2 self.num_nodes = 2
self.extra_args= [["-maxorphantx=1000", self.extra_args = [
[
"-maxorphantx=1000",
"-whitelist=127.0.0.1", "-whitelist=127.0.0.1",
"-limitancestorcount=50", "-limitancestorcount=50",
"-limitancestorsize=101", "-limitancestorsize=101",
"-limitdescendantcount=200", "-limitdescendantcount=200",
"-limitdescendantsize=101"], "-limitdescendantsize=101",
["-mempoolreplacement=0"]] ],
[
"-mempoolreplacement=0",
],
]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
# Leave IBD # Leave IBD

View File

@ -18,6 +18,9 @@ class ReindexTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 1 self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def reindex(self, justchainstate=False): def reindex(self, justchainstate=False):
self.nodes[0].generate(3) self.nodes[0].generate(3)
blockcount = self.nodes[0].getblockcount() blockcount = self.nodes[0].getblockcount()

View File

@ -46,9 +46,30 @@ class SegWitTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 3 self.num_nodes = 3
# This test tests SegWit both pre and post-activation, so use the normal BIP9 activation. # This test tests SegWit both pre and post-activation, so use the normal BIP9 activation.
self.extra_args = [["-rpcserialversion=0", "-vbparams=segwit:0:999999999999", "-addresstype=legacy", "-deprecatedrpc=addwitnessaddress"], self.extra_args = [
["-blockversion=4", "-rpcserialversion=1", "-vbparams=segwit:0:999999999999", "-addresstype=legacy", "-deprecatedrpc=addwitnessaddress"], [
["-blockversion=536870915", "-vbparams=segwit:0:999999999999", "-addresstype=legacy", "-deprecatedrpc=addwitnessaddress"]] "-rpcserialversion=0",
"-vbparams=segwit:0:999999999999",
"-addresstype=legacy",
"-deprecatedrpc=addwitnessaddress",
],
[
"-blockversion=4",
"-rpcserialversion=1",
"-vbparams=segwit:0:999999999999",
"-addresstype=legacy",
"-deprecatedrpc=addwitnessaddress",
],
[
"-blockversion=536870915",
"-vbparams=segwit:0:999999999999",
"-addresstype=legacy",
"-deprecatedrpc=addwitnessaddress",
],
]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
super().setup_network() super().setup_network()

View File

@ -31,6 +31,9 @@ class VersionBitsWarningTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 1 self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt") self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
# Open and close to create zero-length file # Open and close to create zero-length file

View File

@ -12,6 +12,9 @@ class TestBitcoinCli(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 1 self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
"""Main test logic""" """Main test logic"""

View File

@ -43,6 +43,9 @@ class RESTTest (BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.extra_args = [["-rest"], []] 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): def test_rest_request(self, uri, http_method='GET', req_type=ReqType.JSON, body='', status=200, ret_type=RetType.JSON):
rest_uri = '/rest' + uri rest_uri = '/rest' + uri
if req_type == ReqType.JSON: if req_type == ReqType.JSON:

View File

@ -5,15 +5,16 @@
"""Test the ZMQ notification interface.""" """Test the ZMQ notification interface."""
import struct import struct
from test_framework.test_framework import ( from test_framework.test_framework import BitcoinTestFramework
BitcoinTestFramework, skip_if_no_bitcoind_zmq, skip_if_no_py3_zmq)
from test_framework.messages import CTransaction from test_framework.messages import CTransaction
from test_framework.util import (assert_equal, from test_framework.util import (
assert_equal,
bytes_to_hex_str, bytes_to_hex_str,
hash256, hash256,
) )
from io import BytesIO from io import BytesIO
class ZMQSubscriber: class ZMQSubscriber:
def __init__(self, socket, topic): def __init__(self, socket, topic):
self.sequence = 0 self.sequence = 0
@ -37,9 +38,18 @@ class ZMQTest (BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 2 self.num_nodes = 2
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): def setup_nodes(self):
skip_if_no_py3_zmq() # Import keys
skip_if_no_bitcoind_zmq(self) self.add_nodes(self.num_nodes)
self.start_nodes()
super().import_deterministic_coinbase_privkeys()
self.stop_nodes()
import zmq import zmq
# Initialize ZMQ context and socket. # Initialize ZMQ context and socket.
@ -59,10 +69,12 @@ class ZMQTest (BitcoinTestFramework):
self.rawblock = ZMQSubscriber(socket, b"rawblock") self.rawblock = ZMQSubscriber(socket, b"rawblock")
self.rawtx = ZMQSubscriber(socket, b"rawtx") self.rawtx = ZMQSubscriber(socket, b"rawtx")
self.extra_args = [["-zmqpub%s=%s" % (sub.topic.decode(), address) for sub in [self.hashblock, self.hashtx, self.rawblock, self.rawtx]], []] self.nodes[0].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() self.start_nodes()
def import_deterministic_coinbase_privkeys(self):
pass
def run_test(self): def run_test(self):
try: try:
self._zmq_test() self._zmq_test()

View File

@ -40,6 +40,9 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
'-acceptnonstdtxn=0', # Try to mimic main-net '-acceptnonstdtxn=0', # Try to mimic main-net
]] * self.num_nodes ]] * self.num_nodes
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def check_mempool_result(self, result_expected, *args, **kwargs): def check_mempool_result(self, result_expected, *args, **kwargs):
"""Wrapper to check result of testmempoolaccept on node_0's mempool""" """Wrapper to check result of testmempoolaccept on node_0's mempool"""
result_test = self.nodes[0].testmempoolaccept(*args, **kwargs) result_test = self.nodes[0].testmempoolaccept(*args, **kwargs)

View File

@ -15,6 +15,9 @@ class MempoolLimitTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.extra_args = [["-maxmempool=5", "-spendzeroconfchange=0"]] self.extra_args = [["-maxmempool=5", "-spendzeroconfchange=0"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
txouts = gen_return_txouts() txouts = gen_return_txouts()
relayfee = self.nodes[0].getnetworkinfo()['relayfee'] relayfee = self.nodes[0].getnetworkinfo()['relayfee']

View File

@ -18,6 +18,9 @@ class MempoolPackagesTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.extra_args = [["-maxorphantx=1000"], ["-maxorphantx=1000", "-limitancestorcount=5"]] self.extra_args = [["-maxorphantx=1000"], ["-maxorphantx=1000", "-limitancestorcount=5"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
# Build a transaction that spends parent_txid:vout # Build a transaction that spends parent_txid:vout
# Return amount sent # Return amount sent
def chain_transaction(self, node, parent_txid, vout, value, fee, num_outputs): def chain_transaction(self, node, parent_txid, vout, value, fee, num_outputs):
@ -34,7 +37,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
return (txid, send_value) return (txid, send_value)
def run_test(self): def run_test(self):
''' Mine some blocks and have them mature. ''' # Mine some blocks and have them mature.
self.nodes[0].generate(101) self.nodes[0].generate(101)
utxo = self.nodes[0].listunspent(10) utxo = self.nodes[0].listunspent(10)
txid = utxo[0]['txid'] txid = utxo[0]['txid']

View File

@ -47,6 +47,9 @@ class MempoolPersistTest(BitcoinTestFramework):
self.num_nodes = 3 self.num_nodes = 3
self.extra_args = [[], ["-persistmempool=0"], []] self.extra_args = [[], ["-persistmempool=0"], []]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
chain_height = self.nodes[0].getblockcount() chain_height = self.nodes[0].getblockcount()
assert_equal(chain_height, 200) assert_equal(chain_height, 200)

View File

@ -17,6 +17,9 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 2 self.num_nodes = 2
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
alert_filename = None # Set by setup_network alert_filename = None # Set by setup_network
def run_test(self): def run_test(self):

View File

@ -13,6 +13,9 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 1 self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
node0_address = self.nodes[0].getnewaddress() node0_address = self.nodes[0].getnewaddress()
# Spend block 1/2/3's coinbase transactions # Spend block 1/2/3's coinbase transactions

View File

@ -21,6 +21,9 @@ class MempoolSpendCoinbaseTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 1 self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
chain_height = self.nodes[0].getblockcount() chain_height = self.nodes[0].getblockcount()
assert_equal(chain_height, 200) assert_equal(chain_height, 200)

View File

@ -38,6 +38,9 @@ class MiningTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.setup_clean_chain = False self.setup_clean_chain = False
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
node = self.nodes[0] node = self.nodes[0]

View File

@ -28,6 +28,9 @@ class GetBlockTemplateLPTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 2 self.num_nodes = 2
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.log.info("Warning: this test will take about 70 seconds in the best case. Be patient.") self.log.info("Warning: this test will take about 70 seconds in the best case. Be patient.")
self.nodes[0].generate(10) self.nodes[0].generate(10)
@ -70,4 +73,3 @@ class GetBlockTemplateLPTest(BitcoinTestFramework):
if __name__ == '__main__': if __name__ == '__main__':
GetBlockTemplateLPTest().main() GetBlockTemplateLPTest().main()

View File

@ -16,6 +16,9 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.extra_args = [["-printpriority=1"], ["-printpriority=1"]] self.extra_args = [["-printpriority=1"], ["-printpriority=1"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
# Test `prioritisetransaction` required parameters # Test `prioritisetransaction` required parameters
assert_raises_rpc_error(-1, "prioritisetransaction", self.nodes[0].prioritisetransaction) assert_raises_rpc_error(-1, "prioritisetransaction", self.nodes[0].prioritisetransaction)

View File

@ -102,6 +102,9 @@ class CompactBlocksTest(BitcoinTestFramework):
self.extra_args = [["-vbparams=segwit:0:0"], ["-vbparams=segwit:0:999999999999", "-txindex", "-deprecatedrpc=addwitnessaddress"]] self.extra_args = [["-vbparams=segwit:0:0"], ["-vbparams=segwit:0:999999999999", "-txindex", "-deprecatedrpc=addwitnessaddress"]]
self.utxos = [] self.utxos = []
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def build_block_on_tip(self, node, segwit=False): def build_block_on_tip(self, node, segwit=False):
height = node.getblockcount() height = node.getblockcount()
tip = node.getbestblockhash() tip = node.getbestblockhash()

View File

@ -42,6 +42,9 @@ class FeeFilterTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 2 self.num_nodes = 2
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
node1 = self.nodes[1] node1 = self.nodes[1]
node0 = self.nodes[0] node0 = self.nodes[0]

View File

@ -30,6 +30,9 @@ class P2PFingerprintTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 1 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 # Build a chain of blocks on top of given one
def build_chain(self, nblocks, prev_hash, prev_height, prev_median_time): def build_chain(self, nblocks, prev_hash, prev_height, prev_median_time):
blocks = [] blocks = []

View File

@ -24,6 +24,9 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.extra_args = [["-whitelist=127.0.0.1"]] self.extra_args = [["-whitelist=127.0.0.1"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
# Add p2p connection to node0 # Add p2p connection to node0
node = self.nodes[0] # convenience reference to the node node = self.nodes[0] # convenience reference to the node

View File

@ -15,6 +15,9 @@ class InvalidLocatorTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.setup_clean_chain = False self.setup_clean_chain = False
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
node = self.nodes[0] # convenience reference to the node node = self.nodes[0] # convenience reference to the node
node.generate(1) # Get node out of IBD node.generate(1) # Get node out of IBD

View File

@ -26,6 +26,9 @@ class InvalidTxRequestTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def bootstrap_p2p(self, *, num_connections=1): def bootstrap_p2p(self, *, num_connections=1):
"""Add a P2P connection to the node. """Add a P2P connection to the node.

View File

@ -93,6 +93,9 @@ class P2PLeakTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.extra_args = [['-banscore=' + str(banscore)]] self.extra_args = [['-banscore=' + str(banscore)]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
no_version_bannode = self.nodes[0].add_p2p_connection(CNodeNoVersionBan(), send_version=False, wait_for_verack=False) 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) no_version_idlenode = self.nodes[0].add_p2p_connection(CNodeNoVersionIdle(), send_version=False, wait_for_verack=False)

View File

@ -34,6 +34,9 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
self.num_nodes = 3 self.num_nodes = 3
self.extra_args = [['-prune=550', '-addrmantest'], [], []] self.extra_args = [['-prune=550', '-addrmantest'], [], []]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def disconnect_all(self): def disconnect_all(self):
disconnect_nodes(self.nodes[0], 1) disconnect_nodes(self.nodes[0], 1)
disconnect_nodes(self.nodes[1], 0) disconnect_nodes(self.nodes[1], 0)

View File

@ -188,6 +188,9 @@ class SegWitTest(BitcoinTestFramework):
# This test tests SegWit both pre and post-activation, so use the normal BIP9 activation. # This test tests SegWit both pre and post-activation, so use the normal BIP9 activation.
self.extra_args = [["-whitelist=127.0.0.1", "-vbparams=segwit:0:999999999999"], ["-whitelist=127.0.0.1", "-acceptnonstdtxn=0", "-vbparams=segwit:0:999999999999"], ["-whitelist=127.0.0.1", "-vbparams=segwit:0:0"]] self.extra_args = [["-whitelist=127.0.0.1", "-vbparams=segwit:0:999999999999"], ["-whitelist=127.0.0.1", "-acceptnonstdtxn=0", "-vbparams=segwit:0:999999999999"], ["-whitelist=127.0.0.1", "-vbparams=segwit:0:0"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
self.setup_nodes() self.setup_nodes()
connect_nodes(self.nodes[0], 1) connect_nodes(self.nodes[0], 1)

View File

@ -208,6 +208,9 @@ class SendHeadersTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 2 self.num_nodes = 2
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def mine_blocks(self, count): def mine_blocks(self, count):
"""Mine count blocks and return the new tip.""" """Mine count blocks and return the new tip."""

View File

@ -66,6 +66,9 @@ class AcceptBlockTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.extra_args = [[], ["-minimumchainwork=0x10"]] self.extra_args = [[], ["-minimumchainwork=0x10"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
# Node0 will be used to test behavior of processing unrequested blocks # Node0 will be used to test behavior of processing unrequested blocks
# from peers which are not whitelisted, while Node1 will be used for # from peers which are not whitelisted, while Node1 will be used for

View File

@ -47,9 +47,13 @@ from test_framework.mininode import (
class BlockchainTest(BitcoinTestFramework): class BlockchainTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 1 self.num_nodes = 1
self.extra_args = [['-stopatheight=207', '-prune=1']]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.restart_node(0, extra_args=['-stopatheight=207', '-prune=1']) # Set extra args with pruning after rescan is complete
self._test_getblockchaininfo() self._test_getblockchaininfo()
self._test_getchaintxstats() self._test_getchaintxstats()
self._test_gettxoutsetinfo() self._test_gettxoutsetinfo()
@ -169,7 +173,7 @@ class BlockchainTest(BitcoinTestFramework):
assert_equal(res['transactions'], 200) assert_equal(res['transactions'], 200)
assert_equal(res['height'], 200) assert_equal(res['height'], 200)
assert_equal(res['txouts'], 200) assert_equal(res['txouts'], 200)
assert_equal(res['bogosize'], 17000), assert_equal(res['bogosize'], 15000),
assert_equal(res['bestblock'], node.getblockhash(200)) assert_equal(res['bestblock'], node.getblockhash(200))
size = res['disk_size'] size = res['disk_size']
assert size > 6400 assert size > 6400

View File

@ -12,8 +12,11 @@ class RpcCreateMultiSigTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 3 self.num_nodes = 3
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def get_keys(self): def get_keys(self):
node0,node1,node2 = self.nodes node0, node1, node2 = self.nodes
self.add = [node1.getnewaddress() for _ in range(self.nkeys)] self.add = [node1.getnewaddress() for _ in range(self.nkeys)]
self.pub = [node1.getaddressinfo(a)["pubkey"] for a in self.add] self.pub = [node1.getaddressinfo(a)["pubkey"] for a in self.add]
self.priv = [node1.dumpprivkey(a) for a in self.add] self.priv = [node1.dumpprivkey(a) for a in self.add]

View File

@ -29,6 +29,9 @@ class RawTransactionsTest(BitcoinTestFramework):
self.num_nodes = 4 self.num_nodes = 4
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self, split=False): def setup_network(self, split=False):
self.setup_nodes() self.setup_nodes()

View File

@ -17,15 +17,18 @@ class GetChainTipsTest (BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 4 self.num_nodes = 4
def run_test (self): def skip_test_if_missing_module(self):
tips = self.nodes[0].getchaintips () self.skip_if_no_wallet()
assert_equal (len (tips), 1)
assert_equal (tips[0]['branchlen'], 0) def run_test(self):
assert_equal (tips[0]['height'], 200) tips = self.nodes[0].getchaintips()
assert_equal (tips[0]['status'], 'active') 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. # Split the network and build two chains of different lengths.
self.split_network () self.split_network()
self.nodes[0].generate(10) self.nodes[0].generate(10)
self.nodes[2].generate(20) self.nodes[2].generate(20)
self.sync_all([self.nodes[:2], self.nodes[2:]]) self.sync_all([self.nodes[:2], self.nodes[2:]])

View File

@ -4,9 +4,10 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPC help output.""" """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 from test_framework.util import assert_equal, assert_raises_rpc_error
class HelpRpcTest(BitcoinTestFramework): class HelpRpcTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 1 self.num_nodes = 1
@ -26,12 +27,16 @@ class HelpRpcTest(BitcoinTestFramework):
# command titles # command titles
titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')] titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')]
components = ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util', 'Wallet'] components = ['Blockchain', 'Control', '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') components.append('Zmq')
assert_equal(titles, components) assert_equal(titles, components)
if __name__ == '__main__': if __name__ == '__main__':
HelpRpcTest().main() HelpRpcTest().main()

View File

@ -14,6 +14,9 @@ class InvalidateTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 3 self.num_nodes = 3
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
self.setup_nodes() self.setup_nodes()

View File

@ -38,6 +38,9 @@ class PreciousTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 3 self.num_nodes = 3
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
self.setup_nodes() self.setup_nodes()

View File

@ -20,6 +20,9 @@ class PSBTTest(BitcoinTestFramework):
self.setup_clean_chain = False self.setup_clean_chain = False
self.num_nodes = 3 self.num_nodes = 3
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
# Create and fund a raw tx for sending 10 BTC # Create and fund a raw tx for sending 10 BTC
psbtx1 = self.nodes[0].walletcreatefundedpsbt([], {self.nodes[2].getnewaddress():10})['psbt'] psbtx1 = self.nodes[0].walletcreatefundedpsbt([], {self.nodes[2].getnewaddress():10})['psbt']

View File

@ -44,6 +44,9 @@ class RawTransactionsTest(BitcoinTestFramework):
self.num_nodes = 3 self.num_nodes = 3
self.extra_args = [["-addresstype=legacy"], ["-addresstype=legacy"], ["-addresstype=legacy"]] self.extra_args = [["-addresstype=legacy"], ["-addresstype=legacy"], ["-addresstype=legacy"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self, split=False): def setup_network(self, split=False):
super().setup_network() super().setup_network()
connect_nodes_bi(self.nodes, 0, 2) connect_nodes_bi(self.nodes, 0, 2)

View File

@ -14,6 +14,10 @@ class ScantxoutsetTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 1 self.num_nodes = 1
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.log.info("Mining blocks...") self.log.info("Mining blocks...")
self.nodes[0].generate(110) self.nodes[0].generate(110)

View File

@ -13,6 +13,9 @@ class SignMessagesTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.extra_args = [["-addresstype=legacy"]] self.extra_args = [["-addresstype=legacy"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
message = 'This is just a test message' message = 'This is just a test message'

View File

@ -14,6 +14,9 @@ class SignRawTransactionsTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.extra_args = [["-deprecatedrpc=signrawtransaction"]] self.extra_args = [["-deprecatedrpc=signrawtransaction"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def successful_signing_test(self): def successful_signing_test(self):
"""Create and sign a valid raw transaction with one input. """Create and sign a valid raw transaction with one input.

View File

@ -15,6 +15,9 @@ class MerkleBlockTest(BitcoinTestFramework):
# Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing # Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing
self.extra_args = [[], [], [], ["-txindex"]] self.extra_args = [[], [], [], ["-txindex"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
self.setup_nodes() self.setup_nodes()
connect_nodes(self.nodes[0], 1) connect_nodes(self.nodes[0], 1)

View File

@ -4,8 +4,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test for the ZMQ RPC methods.""" """Test for the ZMQ RPC methods."""
from test_framework.test_framework import ( from test_framework.test_framework import BitcoinTestFramework
BitcoinTestFramework, skip_if_no_py3_zmq, skip_if_no_bitcoind_zmq)
from test_framework.util import assert_equal from test_framework.util import assert_equal
@ -17,9 +16,11 @@ class RPCZMQTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_py3_zmq()
self.skip_if_no_bitcoind_zmq()
def run_test(self): def run_test(self):
skip_if_no_py3_zmq()
skip_if_no_bitcoind_zmq(self)
self._test_getzmqnotifications() self._test_getzmqnotifications()
def _test_getzmqnotifications(self): def _test_getzmqnotifications(self):

View File

@ -44,6 +44,13 @@ TEST_EXIT_FAILED = 1
TEST_EXIT_SKIPPED = 77 TEST_EXIT_SKIPPED = 77
class SkipTest(Exception):
"""This exception is raised to skip a test"""
def __init__(self, message):
self.message = message
class BitcoinTestMetaClass(type): class BitcoinTestMetaClass(type):
"""Metaclass for BitcoinTestFramework. """Metaclass for BitcoinTestFramework.
@ -156,8 +163,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
try: try:
if self.options.usecli and not self.supports_cli: if self.options.usecli and not self.supports_cli:
raise SkipTest("--usecli specified but test does not support using CLI") raise SkipTest("--usecli specified but test does not support using CLI")
self.skip_test_if_missing_module()
self.setup_chain() self.setup_chain()
self.setup_network() self.setup_network()
self.import_deterministic_coinbase_privkeys()
self.run_test() self.run_test()
success = TestStatus.PASSED success = TestStatus.PASSED
except JSONRPCException as e: except JSONRPCException as e:
@ -220,6 +229,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
"""Override this method to add command-line options to the test""" """Override this method to add command-line options to the test"""
pass 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): def setup_chain(self):
"""Override this method to customize blockchain setup""" """Override this method to customize blockchain setup"""
self.log.info("Initializing test directory " + self.options.tmpdir) self.log.info("Initializing test directory " + self.options.tmpdir)
@ -247,6 +260,19 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
self.add_nodes(self.num_nodes, extra_args) self.add_nodes(self.num_nodes, extra_args)
self.start_nodes() self.start_nodes()
def import_deterministic_coinbase_privkeys(self):
if self.setup_clean_chain:
return
for n in self.nodes:
try:
n.getwalletinfo()
except JSONRPCException as e:
assert str(e).startswith('Method not found')
continue
n.importprivkey(n.get_deterministic_priv_key()[1])
def run_test(self): def run_test(self):
"""Tests must override this method to define test logic""" """Tests must override this method to define test logic"""
raise NotImplementedError raise NotImplementedError
@ -415,7 +441,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
# Create cache directories, run bitcoinds: # Create cache directories, run bitcoinds:
for i in range(MAX_NODES): for i in range(MAX_NODES):
datadir = initialize_datadir(self.options.cachedir, i) datadir = initialize_datadir(self.options.cachedir, i)
args = [self.options.bitcoind, "-datadir=" + datadir] args = [self.options.bitcoind, "-datadir=" + datadir, '-disablewallet']
if i > 0: if i > 0:
args.append("-connect=127.0.0.1:" + str(p2p_port(0))) args.append("-connect=127.0.0.1:" + str(p2p_port(0)))
self.nodes.append(TestNode(i, get_datadir_path(self.options.cachedir, i), extra_conf=["bind=127.0.0.1"], extra_args=[], rpchost=None, timewait=self.rpc_timewait, bitcoind=self.options.bitcoind, bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=None)) self.nodes.append(TestNode(i, get_datadir_path(self.options.cachedir, i), extra_conf=["bind=127.0.0.1"], extra_args=[], rpchost=None, timewait=self.rpc_timewait, bitcoind=self.options.bitcoind, bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=None))
@ -439,7 +465,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
for peer in range(4): for peer in range(4):
for j in range(25): for j in range(25):
set_node_times(self.nodes, block_time) set_node_times(self.nodes, block_time)
self.nodes[peer].generate(1) self.nodes[peer].generatetoaddress(1, self.nodes[peer].get_deterministic_priv_key()[0])
block_time += 10 * 60 block_time += 10 * 60
# Must sync before next peer starts generating blocks # Must sync before next peer starts generating blocks
sync_blocks(self.nodes) sync_blocks(self.nodes)
@ -453,8 +479,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
return os.path.join(get_datadir_path(self.options.cachedir, n), "regtest", *paths) return os.path.join(get_datadir_path(self.options.cachedir, n), "regtest", *paths)
for i in range(MAX_NODES): for i in range(MAX_NODES):
os.rmdir(cache_path(i, 'wallets')) # Remove empty wallets dir
for entry in os.listdir(cache_path(i)): for entry in os.listdir(cache_path(i)):
if entry not in ['wallets', 'chainstate', 'blocks']: if entry not in ['chainstate', 'blocks']:
os.remove(cache_path(i, entry)) os.remove(cache_path(i, entry))
for i in range(self.num_nodes): for i in range(self.num_nodes):
@ -471,30 +498,45 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
for i in range(self.num_nodes): for i in range(self.num_nodes):
initialize_datadir(self.options.tmpdir, i) initialize_datadir(self.options.tmpdir, i)
def skip_if_no_py3_zmq(self):
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.""" """Attempt to import the zmq package and skip the test if the import fails."""
try: try:
import zmq # noqa import zmq # noqa
except ImportError: except ImportError:
raise SkipTest("python3-zmq module not available.") raise SkipTest("python3-zmq module not available.")
def skip_if_no_bitcoind_zmq(self):
def skip_if_no_bitcoind_zmq(test_instance):
"""Skip the running test if bitcoind has not been compiled with zmq support.""" """Skip the running test if bitcoind has not been compiled with zmq support."""
if not is_zmq_enabled(test_instance): if not self.is_zmq_compiled():
raise SkipTest("bitcoind has not been built with zmq enabled.") raise SkipTest("bitcoind 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 is_zmq_enabled(test_instance): def skip_if_no_cli(self):
"""Checks whether zmq is enabled or not.""" """Skip the running test if bitcoin-cli has not been compiled."""
if not self.is_cli_compiled():
raise SkipTest("bitcoin-cli has not been compiled.")
def is_cli_compiled(self):
"""Checks whether bitcoin-cli was compiled."""
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read_file(open(test_instance.options.configfile)) 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") return config["components"].getboolean("ENABLE_ZMQ")

View File

@ -97,6 +97,22 @@ class TestNode():
self.p2ps = [] self.p2ps = []
def get_deterministic_priv_key(self):
"""Return a deterministic priv key in base58, that only depends on the node's index"""
PRIV_KEYS = [
# adress , privkey
('mjTkW3DjgyZck4KbiRusZsqTgaYTxdSz6z', 'cVpF924EspNh8KjYsfhgY96mmxvT6DgdWiTYMtMjuM74hJaU5psW'),
('msX6jQXvxiNhx3Q62PKeLPrhrqZQdSimTg', 'cUxsWyKyZ9MAQTaAhUQWJmBbSvHMwSmuv59KgxQV7oZQU3PXN3KE'),
('mnonCMyH9TmAsSj3M59DsbH8H63U3RKoFP', 'cTrh7dkEAeJd6b3MRX9bZK8eRmNqVCMH3LSUkE3dSFDyzjU38QxK'),
('mqJupas8Dt2uestQDvV2NH3RU8uZh2dqQR', 'cVuKKa7gbehEQvVq717hYcbE9Dqmq7KEBKqWgWrYBa2CKKrhtRim'),
('msYac7Rvd5ywm6pEmkjyxhbCDKqWsVeYws', 'cQDCBuKcjanpXDpCqacNSjYfxeQj8G6CAtH1Dsk3cXyqLNC4RPuh'),
('n2rnuUnwLgXqf9kk2kjvVm8R5BZK1yxQBi', 'cQakmfPSLSqKHyMFGwAqKHgWUiofJCagVGhiB4KCainaeCSxeyYq'),
('myzuPxRwsf3vvGzEuzPfK9Nf2RfwauwYe6', 'cQMpDLJwA8DBe9NcQbdoSb1BhmFxVjWD5gRyrLZCtpuF9Zi3a9RK'),
('mumwTaMtbxEPUswmLBBN3vM9oGRtGBrys8', 'cSXmRKXVcoouhNNVpcNKFfxsTsToY5pvB9DVsFksF1ENunTzRKsy'),
('mpV7aGShMkJCZgbW7F6iZgrvuPHjZjH9qg', 'cSoXt6tm3pqy43UMabY6eUTmR3eSUYFtB2iNQDGgb3VUnRsQys2k'),
]
return PRIV_KEYS[self.index]
def _node_msg(self, msg: str) -> str: def _node_msg(self, msg: str) -> str:
"""Return a modified msg that identifies this node by its index as a debugging aid.""" """Return a modified msg that identifies this node by its index as a debugging aid."""
return "[node %d] %s" % (self.index, msg) return "[node %d] %s" % (self.index, msg)

View File

@ -236,8 +236,6 @@ def main():
logging.debug("Temporary test directory at %s" % tmpdir) 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") enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
if config["environment"]["EXEEXT"] == ".exe" and not args.force: if config["environment"]["EXEEXT"] == ".exe" and not args.force:
@ -246,9 +244,9 @@ def main():
print("Tests currently disabled on Windows by default. Use --force option to enable") print("Tests currently disabled on Windows by default. Use --force option to enable")
sys.exit(0) sys.exit(0)
if not (enable_wallet and enable_utils and enable_bitcoind): if not enable_bitcoind:
print("No functional tests to run. Wallet, utils, and bitcoind must all be enabled") print("No functional tests to run.")
print("Rerun `configure` with -enable-wallet, -with-utils and -with-daemon and rerun make") print("Rerun ./configure with --with-daemon and then make")
sys.exit(0) sys.exit(0)
# Build list of tests # Build list of tests

View File

@ -20,6 +20,9 @@ class AbandonConflictTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.extra_args = [["-minrelaytxfee=0.00001"], []] self.extra_args = [["-minrelaytxfee=0.00001"], []]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.nodes[1].generate(100) self.nodes[1].generate(100)
sync_blocks(self.nodes) sync_blocks(self.nodes)

View File

@ -63,6 +63,7 @@ from test_framework.util import (
sync_mempools, sync_mempools,
) )
class AddressTypeTest(BitcoinTestFramework): class AddressTypeTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 6 self.num_nodes = 6
@ -72,9 +73,12 @@ class AddressTypeTest(BitcoinTestFramework):
["-addresstype=p2sh-segwit", "-changetype=bech32"], ["-addresstype=p2sh-segwit", "-changetype=bech32"],
["-addresstype=bech32"], ["-addresstype=bech32"],
["-changetype=p2sh-segwit"], ["-changetype=p2sh-segwit"],
[] [],
] ]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
self.setup_nodes() self.setup_nodes()

View File

@ -45,6 +45,9 @@ class WalletBackupTest(BitcoinTestFramework):
# nodes 1, 2,3 are spenders, let's give them a keypool=100 # nodes 1, 2,3 are spenders, let's give them a keypool=100
self.extra_args = [["-keypool=100"], ["-keypool=100"], ["-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, split=False): def setup_network(self, split=False):
self.setup_nodes() self.setup_nodes()
connect_nodes(self.nodes[0], 3) connect_nodes(self.nodes[0], 3)

View File

@ -23,6 +23,9 @@ class WalletTest(BitcoinTestFramework):
self.num_nodes = 4 self.num_nodes = 4
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
self.add_nodes(4) self.add_nodes(4)
self.start_node(0) self.start_node(0)

View File

@ -31,8 +31,14 @@ class BumpFeeTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 2 self.num_nodes = 2
self.setup_clean_chain = True self.setup_clean_chain = True
self.extra_args = [["-deprecatedrpc=addwitnessaddress", "-walletrbf={}".format(i), "-mintxfee=0.00002"] self.extra_args = [[
for i in range(self.num_nodes)] "-deprecatedrpc=addwitnessaddress",
"-walletrbf={}".format(i),
"-mintxfee=0.00002",
] for i in range(self.num_nodes)]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
# Encrypt wallet for test_locked_wallet_fails test # Encrypt wallet for test_locked_wallet_fails test

View File

@ -17,6 +17,9 @@ class DisablePrivateKeysTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.supports_cli = True self.supports_cli = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
node = self.nodes[0] node = self.nodes[0]
self.log.info("Test disableprivatekeys creation.") self.log.info("Test disableprivatekeys creation.")

View File

@ -29,19 +29,23 @@ def read_dump(file_name, addrs, script_addrs, hd_master_addr_old):
# only read non comment lines # only read non comment lines
if line[0] != "#" and len(line) > 10: if line[0] != "#" and len(line) > 10:
# split out some data # split out some data
key_label, comment = line.split("#") key_date_label, comment = line.split("#")
# key = key_label.split(" ")[0] key_date_label = key_date_label.split(" ")
keytype = key_label.split(" ")[2] # key = key_date_label[0]
if len(comment) > 1: date = key_date_label[1]
keytype = key_date_label[2]
if not len(comment) or date.startswith('1970'):
continue
addr_keypath = comment.split(" addr=")[1] addr_keypath = comment.split(" addr=")[1]
addr = addr_keypath.split(" ")[0] addr = addr_keypath.split(" ")[0]
keypath = None keypath = None
if keytype == "inactivehdseed=1": if keytype == "inactivehdseed=1":
# ensure the old master is still available # ensure the old master is still available
assert(hd_master_addr_old == addr) assert (hd_master_addr_old == addr)
elif keytype == "hdseed=1": elif keytype == "hdseed=1":
# ensure we have generated a new hd master key # ensure we have generated a new hd master key
assert(hd_master_addr_old != addr) assert (hd_master_addr_old != addr)
hd_master_addr_ret = addr hd_master_addr_ret = addr
elif keytype == "script=1": elif keytype == "script=1":
# scripts don't have keypaths # scripts don't have keypaths
@ -83,6 +87,9 @@ class WalletDumpTest(BitcoinTestFramework):
self.extra_args = [["-keypool=90", "-addresstype=legacy", "-deprecatedrpc=addwitnessaddress"]] self.extra_args = [["-keypool=90", "-addresstype=legacy", "-deprecatedrpc=addwitnessaddress"]]
self.rpc_timeout = 120 self.rpc_timeout = 120
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self, split=False): def setup_network(self, split=False):
self.add_nodes(self.num_nodes, extra_args=self.extra_args) self.add_nodes(self.num_nodes, extra_args=self.extra_args)
self.start_nodes() self.start_nodes()
@ -116,8 +123,8 @@ class WalletDumpTest(BitcoinTestFramework):
read_dump(wallet_unenc_dump, addrs, script_addrs, None) read_dump(wallet_unenc_dump, addrs, script_addrs, None)
assert_equal(found_addr, test_addr_count) # all keys must be in the dump assert_equal(found_addr, test_addr_count) # all keys must be in the dump
assert_equal(found_script_addr, 2) # all scripts must be in the dump assert_equal(found_script_addr, 2) # all scripts must be in the dump
assert_equal(found_addr_chg, 50) # 50 blocks where mined assert_equal(found_addr_chg, 0) # 0 blocks where mined
assert_equal(found_addr_rsv, 90*2) # 90 keys plus 100% internal keys assert_equal(found_addr_rsv, 90 * 2) # 90 keys plus 100% internal keys
assert_equal(witness_addr_ret, witness_addr) # p2sh-p2wsh address added to the first key assert_equal(witness_addr_ret, witness_addr) # p2sh-p2wsh address added to the first key
#encrypt wallet, restart, unlock and dump #encrypt wallet, restart, unlock and dump
@ -132,8 +139,8 @@ class WalletDumpTest(BitcoinTestFramework):
read_dump(wallet_enc_dump, addrs, script_addrs, hd_master_addr_unenc) read_dump(wallet_enc_dump, addrs, script_addrs, hd_master_addr_unenc)
assert_equal(found_addr, test_addr_count) assert_equal(found_addr, test_addr_count)
assert_equal(found_script_addr, 2) assert_equal(found_script_addr, 2)
assert_equal(found_addr_chg, 90*2 + 50) # old reserve keys are marked as change now assert_equal(found_addr_chg, 90 * 2) # old reserve keys are marked as change now
assert_equal(found_addr_rsv, 90*2) assert_equal(found_addr_rsv, 90 * 2)
assert_equal(witness_addr_ret, witness_addr) assert_equal(witness_addr_ret, witness_addr)
# Overwriting should fail # Overwriting should fail

View File

@ -19,6 +19,9 @@ class WalletEncryptionTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 1 self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
passphrase = "WalletPassphrase" passphrase = "WalletPassphrase"
passphrase2 = "SecondWalletPassphrase" passphrase2 = "SecondWalletPassphrase"

View File

@ -11,6 +11,9 @@ class WalletRBFTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.nodes[0].generate(101) self.nodes[0].generate(101)

View File

@ -23,7 +23,10 @@ class WalletGroupTest(BitcoinTestFramework):
self.extra_args = [[], [], ['-avoidpartialspends']] self.extra_args = [[], [], ['-avoidpartialspends']]
self.rpc_timewait = 120 self.rpc_timewait = 120
def run_test (self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
# Mine some coins # Mine some coins
self.nodes[0].generate(110) self.nodes[0].generate(110)

View File

@ -21,6 +21,9 @@ class WalletHDTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.extra_args = [[], ['-keypool=0']] self.extra_args = [[], ['-keypool=0']]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
# Make sure can't switch off usehd after wallet creation # Make sure can't switch off usehd after wallet creation
self.stop_node(1) self.stop_node(1)

View File

@ -109,6 +109,9 @@ class ImportRescanTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 2 + len(IMPORT_NODES) self.num_nodes = 2 + len(IMPORT_NODES)
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
extra_args = [["-addresstype=legacy"] for _ in range(self.num_nodes)] extra_args = [["-addresstype=legacy"] for _ in range(self.num_nodes)]
for i, import_node in enumerate(IMPORT_NODES, 2): for i, import_node in enumerate(IMPORT_NODES, 2):
@ -116,10 +119,19 @@ class ImportRescanTest(BitcoinTestFramework):
extra_args[i] += ["-prune=1"] extra_args[i] += ["-prune=1"]
self.add_nodes(self.num_nodes, extra_args=extra_args) self.add_nodes(self.num_nodes, extra_args=extra_args)
# Import keys
self.start_nodes(extra_args=[[]] * self.num_nodes)
super().import_deterministic_coinbase_privkeys()
self.stop_nodes()
self.start_nodes() self.start_nodes()
for i in range(1, self.num_nodes): for i in range(1, self.num_nodes):
connect_nodes(self.nodes[i], 0) connect_nodes(self.nodes[i], 0)
def import_deterministic_coinbase_privkeys(self):
pass
def run_test(self): def run_test(self):
# Create one transaction on node 0 with a unique amount for # Create one transaction on node 0 with a unique amount for
# each possible type of wallet import RPC. # each possible type of wallet import RPC.

View File

@ -20,6 +20,9 @@ class ImportMultiTest(BitcoinTestFramework):
self.extra_args = [["-addresstype=legacy"], ["-addresstype=legacy"]] self.extra_args = [["-addresstype=legacy"], ["-addresstype=legacy"]]
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self): def setup_network(self):
self.setup_nodes() self.setup_nodes()

View File

@ -16,6 +16,9 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 2 self.num_nodes = 2
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.log.info("Mining blocks...") self.log.info("Mining blocks...")
self.nodes[0].generate(101) self.nodes[0].generate(101)

View File

@ -13,6 +13,9 @@ class KeyPoolTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 1 self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
nodes = self.nodes nodes = self.nodes
addr_before_encrypting = nodes[0].getnewaddress() addr_before_encrypting = nodes[0].getnewaddress()

View File

@ -27,6 +27,9 @@ class KeypoolRestoreTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.extra_args = [[], ['-keypool=100']] self.extra_args = [[], ['-keypool=100']]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
wallet_path = os.path.join(self.nodes[1].datadir, "regtest", "wallets", "wallet.dat") wallet_path = os.path.join(self.nodes[1].datadir, "regtest", "wallets", "wallet.dat")
wallet_backup_path = os.path.join(self.nodes[1].datadir, "wallet.bak") wallet_backup_path = os.path.join(self.nodes[1].datadir, "wallet.bak")

View File

@ -19,6 +19,9 @@ class WalletLabelsTest(BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 1 self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
# Check that there's no UTXO on the node # Check that there's no UTXO on the node
node = self.nodes[0] node = self.nodes[0]

View File

@ -18,6 +18,14 @@ class ReceivedByTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 2 self.num_nodes = 2
def import_deterministic_coinbase_privkeys(self):
assert_equal(0, len(self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True)))
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): def run_test(self):
# Generate block to get out of IBD # Generate block to get out of IBD
self.nodes[0].generate(1) self.nodes[0].generate(1)
@ -64,7 +72,7 @@ class ReceivedByTest(BitcoinTestFramework):
assert_raises_rpc_error(-4, "address_filter parameter was invalid", self.nodes[1].listreceivedbyaddress, minconf=0, include_empty=True, include_watchonly=True, address_filter="bamboozling") assert_raises_rpc_error(-4, "address_filter parameter was invalid", self.nodes[1].listreceivedbyaddress, minconf=0, include_empty=True, include_watchonly=True, address_filter="bamboozling")
# Another address receive money # Another address receive money
res = self.nodes[1].listreceivedbyaddress(0, True, True) res = self.nodes[1].listreceivedbyaddress(0, True, True)
assert_equal(len(res), 2) # Right now 2 entries assert_equal(len(res), 2 + self.num_cb_reward_addresses) # Right now 2 entries
other_addr = self.nodes[1].getnewaddress() other_addr = self.nodes[1].getnewaddress()
txid2 = self.nodes[0].sendtoaddress(other_addr, 0.1) txid2 = self.nodes[0].sendtoaddress(other_addr, 0.1)
self.nodes[0].generate(1) self.nodes[0].generate(1)
@ -81,7 +89,7 @@ class ReceivedByTest(BitcoinTestFramework):
assert_equal(len(res), 1) assert_equal(len(res), 1)
# Should be two entries though without filter # Should be two entries though without filter
res = self.nodes[1].listreceivedbyaddress(0, True, True) res = self.nodes[1].listreceivedbyaddress(0, True, True)
assert_equal(len(res), 3) # Became 3 entries assert_equal(len(res), 3 + self.num_cb_reward_addresses) # Became 3 entries
# Not on random addr # Not on random addr
other_addr = self.nodes[0].getnewaddress() # note on node[0]! just a random addr other_addr = self.nodes[0].getnewaddress() # note on node[0]! just a random addr

View File

@ -12,6 +12,9 @@ class ListSinceBlockTest (BitcoinTestFramework):
self.num_nodes = 4 self.num_nodes = 4
self.setup_clean_chain = True self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.nodes[2].generate(101) self.nodes[2].generate(101)
self.sync_all() self.sync_all()

View File

@ -27,6 +27,9 @@ class ListTransactionsTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.enable_mocktime() self.enable_mocktime()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
# Simple send, 0 to 1: # Simple send, 0 to 1:
txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1) txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1)

View File

@ -23,6 +23,9 @@ class MultiWalletTest(BitcoinTestFramework):
self.num_nodes = 2 self.num_nodes = 2
self.supports_cli = True self.supports_cli = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
node = self.nodes[0] node = self.nodes[0]

View File

@ -12,6 +12,9 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
self.extra_args = [['--walletbroadcast=false']] self.extra_args = [['--walletbroadcast=false']]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
# Should raise RPC_WALLET_ERROR (-4) if walletbroadcast is disabled. # 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) assert_raises_rpc_error(-4, "Error: Wallet transaction broadcasting is disabled with -walletbroadcast", self.nodes[0].resendwallettransactions)

View File

@ -16,6 +16,9 @@ class TxnMallTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 4 self.num_nodes = 4
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def add_options(self, parser): def add_options(self, parser):
parser.add_argument("--mineblock", dest="mine_block", default=False, action="store_true", parser.add_argument("--mineblock", dest="mine_block", default=False, action="store_true",
help="Test double-spend of 1-confirmed transaction") help="Test double-spend of 1-confirmed transaction")

View File

@ -18,6 +18,9 @@ class TxnMallTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 4 self.num_nodes = 4
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def add_options(self, parser): def add_options(self, parser):
parser.add_argument("--mineblock", dest="mine_block", default=False, action="store_true", parser.add_argument("--mineblock", dest="mine_block", default=False, action="store_true",
help="Test double-spend of 1-confirmed transaction") help="Test double-spend of 1-confirmed transaction")

View File

@ -26,6 +26,9 @@ class ZapWalletTXesTest (BitcoinTestFramework):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 2 self.num_nodes = 2
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self): def run_test(self):
self.log.info("Mining blocks...") self.log.info("Mining blocks...")
self.nodes[0].generate(1) self.nodes[0].generate(1)