aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/example_test.py2
-rwxr-xr-xtest/functional/feature_block.py2
-rwxr-xr-xtest/functional/feature_config_args.py21
-rwxr-xr-xtest/functional/mining_getblocktemplate_longpoll.py12
-rwxr-xr-xtest/functional/p2p_invalid_tx.py2
-rwxr-xr-xtest/functional/p2p_node_network_limited.py2
-rwxr-xr-xtest/functional/p2p_segwit.py2
-rwxr-xr-xtest/functional/rpc_deprecated.py8
-rwxr-xr-xtest/functional/rpc_help.py10
-rwxr-xr-xtest/functional/rpc_psbt.py2
-rwxr-xr-xtest/functional/rpc_signrawtransaction.py12
-rw-r--r--test/functional/test_framework/blocktools.py2
-rwxr-xr-xtest/functional/test_framework/test_framework.py9
13 files changed, 50 insertions, 36 deletions
diff --git a/test/functional/example_test.py b/test/functional/example_test.py
index a8c1474876..3edd760b90 100755
--- a/test/functional/example_test.py
+++ b/test/functional/example_test.py
@@ -76,7 +76,7 @@ class ExampleTest(BitcoinTestFramework):
def set_test_params(self):
"""Override test parameters for your individual test.
- This method must be overridden and num_nodes must be exlicitly set."""
+ This method must be overridden and num_nodes must be explicitly set."""
self.setup_clean_chain = True
self.num_nodes = 3
# Use self.extra_args to change command-line arguments for the nodes
diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py
index 40b5c27580..71c3a396c1 100755
--- a/test/functional/feature_block.py
+++ b/test/functional/feature_block.py
@@ -989,7 +989,7 @@ class FullBlockTest(BitcoinTestFramework):
assert_equal(get_legacy_sigopcount_block(b73), MAX_BLOCK_SIGOPS + 1)
self.sync_blocks([b73], success=False, reject_reason='bad-blk-sigops', reconnect=True)
- # b74/75 - if we push an invalid script element, all prevous sigops are counted,
+ # b74/75 - if we push an invalid script element, all previous sigops are counted,
# but sigops after the element are not counted.
#
# The invalid script element is that the push_data indicates that
diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py
index 62091048f9..9be59b32b4 100755
--- a/test/functional/feature_config_args.py
+++ b/test/functional/feature_config_args.py
@@ -14,8 +14,29 @@ class ConfArgsTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 1
+ def test_config_file_parser(self):
+ # Assume node is stopped
+
+ inc_conf_file_path = os.path.join(self.nodes[0].datadir, 'include.conf')
+ with open(os.path.join(self.nodes[0].datadir, 'bitcoin.conf'), 'a', encoding='utf-8') as conf:
+ conf.write('includeconf={}\n'.format(inc_conf_file_path))
+
+ with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
+ conf.write('-dash=1\n')
+ self.nodes[0].assert_start_raises_init_error(expected_msg='Error reading configuration file: parse error on line 1: -dash=1, options in configuration file must be specified without leading -')
+
+ with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
+ conf.write('nono\n')
+ self.nodes[0].assert_start_raises_init_error(expected_msg='Error reading configuration file: parse error on line 1: nono, if you intended to specify a negated option, use nono=1 instead')
+
+ with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
+ conf.write('') # clear
+
def run_test(self):
self.stop_node(0)
+
+ self.test_config_file_parser()
+
# Remove the -datadir argument so it doesn't override the config file
self.nodes[0].args = [arg for arg in self.nodes[0].args if not arg.startswith("-datadir")]
diff --git a/test/functional/mining_getblocktemplate_longpoll.py b/test/functional/mining_getblocktemplate_longpoll.py
index 2bcbe8db7b..1259754c5a 100755
--- a/test/functional/mining_getblocktemplate_longpoll.py
+++ b/test/functional/mining_getblocktemplate_longpoll.py
@@ -15,8 +15,8 @@ class LongpollThread(threading.Thread):
def __init__(self, node):
threading.Thread.__init__(self)
# query current longpollid
- templat = node.getblocktemplate()
- self.longpollid = templat['longpollid']
+ template = node.getblocktemplate()
+ self.longpollid = template['longpollid']
# create a new connection to the node, we can't use the same
# connection from two threads
self.node = get_rpc_proxy(node.url, 1, timeout=600, coveragedir=node.coverage_dir)
@@ -31,11 +31,11 @@ class GetBlockTemplateLPTest(BitcoinTestFramework):
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)
- templat = self.nodes[0].getblocktemplate()
- longpollid = templat['longpollid']
+ template = self.nodes[0].getblocktemplate()
+ longpollid = template['longpollid']
# longpollid should not change between successive invocations if nothing else happens
- templat2 = self.nodes[0].getblocktemplate()
- assert(templat2['longpollid'] == longpollid)
+ template2 = self.nodes[0].getblocktemplate()
+ assert(template2['longpollid'] == longpollid)
# Test 1: test that the longpolling wait if we do nothing
thr = LongpollThread(self.nodes[0])
diff --git a/test/functional/p2p_invalid_tx.py b/test/functional/p2p_invalid_tx.py
index be0290edfd..69d5dd9f9a 100755
--- a/test/functional/p2p_invalid_tx.py
+++ b/test/functional/p2p_invalid_tx.py
@@ -76,7 +76,7 @@ class InvalidTxRequestTest(BitcoinTestFramework):
self.reconnect_p2p(num_connections=2)
self.log.info('Test orphan transaction handling ... ')
- # Create a root transaction that we withhold until all dependend transactions
+ # Create a root transaction that we withhold until all dependent transactions
# are sent out and in the orphan cache
SCRIPT_PUB_KEY_OP_TRUE = b'\x51\x75' * 15 + b'\x51'
tx_withhold = CTransaction()
diff --git a/test/functional/p2p_node_network_limited.py b/test/functional/p2p_node_network_limited.py
index c987bf4b05..4740740d42 100755
--- a/test/functional/p2p_node_network_limited.py
+++ b/test/functional/p2p_node_network_limited.py
@@ -89,7 +89,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
sync_blocks([self.nodes[0], self.nodes[2]], timeout=5)
except:
pass
- # node2 must remain at heigh 0
+ # node2 must remain at height 0
assert_equal(self.nodes[2].getblockheader(self.nodes[2].getbestblockhash())['height'], 0)
# now connect also to node 1 (non pruned)
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py
index 51c57e88e0..043fa67f77 100755
--- a/test/functional/p2p_segwit.py
+++ b/test/functional/p2p_segwit.py
@@ -460,7 +460,7 @@ class SegWitTest(BitcoinTestFramework):
blocks are permitted to contain witnesses)."""
# node2 doesn't need to be connected for this test.
- # (If it's connected, node0 may propogate an invalid block to it over
+ # (If it's connected, node0 may propagate an invalid block to it over
# compact blocks and the nodes would have inconsistent tips.)
disconnect_nodes(self.nodes[0], 2)
diff --git a/test/functional/rpc_deprecated.py b/test/functional/rpc_deprecated.py
index 32088fe3e1..58074803cc 100755
--- a/test/functional/rpc_deprecated.py
+++ b/test/functional/rpc_deprecated.py
@@ -18,13 +18,7 @@ class DeprecatedRpcTest(BitcoinTestFramework):
# self.log.info("Make sure that -deprecatedrpc=createmultisig allows it to take addresses")
# assert_raises_rpc_error(-5, "Invalid public key", self.nodes[0].createmultisig, 1, [self.nodes[0].getnewaddress()])
# self.nodes[1].createmultisig(1, [self.nodes[1].getnewaddress()])
-
- self.log.info("Test validateaddress deprecation")
- SOME_ADDRESS = "mnvGjUy3NMj67yJ6gkK5o9e5RS33Z2Vqcu" # This is just some random address to pass as a parameter to validateaddress
- dep_validate_address = self.nodes[0].validateaddress(SOME_ADDRESS)
- assert "ismine" not in dep_validate_address
- not_dep_val = self.nodes[1].validateaddress(SOME_ADDRESS)
- assert "ismine" in not_dep_val
+ pass
if __name__ == '__main__':
DeprecatedRpcTest().main()
diff --git a/test/functional/rpc_help.py b/test/functional/rpc_help.py
index e878ded258..ceca40527f 100755
--- a/test/functional/rpc_help.py
+++ b/test/functional/rpc_help.py
@@ -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
+from test_framework.test_framework import BitcoinTestFramework, is_zmq_enabled
from test_framework.util import assert_equal, assert_raises_rpc_error
class HelpRpcTest(BitcoinTestFramework):
@@ -25,7 +25,13 @@ class HelpRpcTest(BitcoinTestFramework):
# command titles
titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')]
- assert_equal(titles, ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util', 'Wallet', 'Zmq'])
+
+ components = ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util', 'Wallet']
+
+ if is_zmq_enabled(self):
+ components.append('Zmq')
+
+ assert_equal(titles, components)
if __name__ == '__main__':
HelpRpcTest().main()
diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py
index d558de5fe1..a693b7e4bb 100755
--- a/test/functional/rpc_psbt.py
+++ b/test/functional/rpc_psbt.py
@@ -105,7 +105,7 @@ class PSBTTest(BitcoinTestFramework):
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx['hex'])
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].converttopsbt, signedtx['hex'])
- # Explicilty allow converting non-empty txs
+ # Explicitly allow converting non-empty txs
new_psbt = self.nodes[0].converttopsbt(rawtx['hex'])
self.nodes[0].decodepsbt(new_psbt)
diff --git a/test/functional/rpc_signrawtransaction.py b/test/functional/rpc_signrawtransaction.py
index 32b099294f..f6eea1a027 100755
--- a/test/functional/rpc_signrawtransaction.py
+++ b/test/functional/rpc_signrawtransaction.py
@@ -42,10 +42,6 @@ class SignRawTransactionsTest(BitcoinTestFramework):
# 2) No script verification error occurred
assert 'errors' not in rawTxSigned
- # Perform the same test on signrawtransaction
- rawTxSigned2 = self.nodes[0].signrawtransaction(rawTx, inputs, privKeys)
- assert_equal(rawTxSigned, rawTxSigned2)
-
def script_verification_error_test(self):
"""Create and sign a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script.
@@ -112,10 +108,6 @@ class SignRawTransactionsTest(BitcoinTestFramework):
assert_equal(rawTxSigned['errors'][1]['vout'], inputs[2]['vout'])
assert not rawTxSigned['errors'][0]['witness']
- # Perform same test with signrawtransaction
- rawTxSigned2 = self.nodes[0].signrawtransaction(rawTx, scripts, privKeys)
- assert_equal(rawTxSigned, rawTxSigned2)
-
# Now test signing failure for transaction with input witnesses
p2wpkh_raw_tx = "01000000000102fff7f7881a8099afa6940d42d1e7f6362bec38171ea3edf433541db4e4ad969f00000000494830450221008b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be022040529b194ba3f9281a99f2b1c0a19c0489bc22ede944ccf4ecbab4cc618ef3ed01eeffffffef51e1b804cc89d182d279655c3aa89e815b1b309fe287d9b2b55d57b90ec68a0100000000ffffffff02202cb206000000001976a9148280b37df378db99f66f85c95a783a76ac7a6d5988ac9093510d000000001976a9143bde42dbee7e4dbe6a21b2d50ce2f0167faa815988ac000247304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee0121025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee635711000000"
@@ -140,10 +132,6 @@ class SignRawTransactionsTest(BitcoinTestFramework):
assert_equal(rawTxSigned['errors'][1]['witness'], ["304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee01", "025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357"])
assert not rawTxSigned['errors'][0]['witness']
- # Perform same test with signrawtransaction
- rawTxSigned2 = self.nodes[0].signrawtransaction(p2wpkh_raw_tx)
- assert_equal(rawTxSigned, rawTxSigned2)
-
def run_test(self):
self.successful_signing_test()
self.script_verification_error_test()
diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py
index 987ade4044..35004fb588 100644
--- a/test/functional/test_framework/blocktools.py
+++ b/test/functional/test_framework/blocktools.py
@@ -122,7 +122,7 @@ def create_tx_with_script(prevtx, n, script_sig=b"", *, amount, script_pub_key=C
"""Return one-input, one-output transaction object
spending the prevtx's n-th output with the given amount.
- Can optionally pass scriptPubKey and scriptSig, default is anyone-can-spend ouput.
+ Can optionally pass scriptPubKey and scriptSig, default is anyone-can-spend output.
"""
tx = CTransaction()
assert(n < len(prevtx.vout))
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index b876d9bd76..0e76b52570 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -488,8 +488,13 @@ def skip_if_no_py3_zmq():
def skip_if_no_bitcoind_zmq(test_instance):
"""Skip the running test if bitcoind has not been compiled with zmq support."""
+ if not is_zmq_enabled(test_instance):
+ raise SkipTest("bitcoind 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))
- if not config["components"].getboolean("ENABLE_ZMQ"):
- raise SkipTest("bitcoind has not been built with zmq enabled.")
+ return config["components"].getboolean("ENABLE_ZMQ")