diff --git a/test/functional/feature_block_v4.py b/test/functional/feature_block_v4.py index 0f5ace0cd0..f803cb39e1 100755 --- a/test/functional/feature_block_v4.py +++ b/test/functional/feature_block_v4.py @@ -6,11 +6,11 @@ from test_framework.blocktools import create_coinbase, create_block, create_transaction from test_framework.messages import msg_block -from test_framework.mininode import mininode_lock, P2PInterface +from test_framework.mininode import P2PInterface from test_framework.test_framework import BitcoinTestFramework -from test_framework.util import assert_equal, wait_until +from test_framework.util import assert_equal -from feature_cltv import cltv_validate, REJECT_OBSOLETE +from feature_cltv import cltv_validate class BlockV4Test(BitcoinTestFramework): def set_test_params(self): @@ -32,19 +32,13 @@ class BlockV4Test(BitcoinTestFramework): block.nVersion = 3 block.solve() - # Send it to the node - self.nodes[0].p2p.send_and_ping(msg_block(block)) - # The best block should not have changed, because... assert_equal(self.nodes[0].getbestblockhash(), tip) # ... we rejected it because it is v3 - wait_until(lambda: "reject" in self.nodes[0].p2p.last_message.keys(), lock=mininode_lock) - with mininode_lock: - assert_equal(self.nodes[0].p2p.last_message["reject"].code, REJECT_OBSOLETE) - assert_equal(self.nodes[0].p2p.last_message["reject"].reason, b'bad-version(0x00000003)') - assert_equal(self.nodes[0].p2p.last_message["reject"].data, block.sha256) - del self.nodes[0].p2p.last_message["reject"] + with self.nodes[0].assert_debug_log(expected_msgs=['{}, bad-version(0x00000003)'.format(block.hash)]): + # Send it to the node + self.nodes[0].p2p.send_and_ping(msg_block(block)) self.log.info("Test that a version 4 block with a valid-according-to-CLTV transaction is accepted") diff --git a/test/functional/feature_mandatory_coinbase.py b/test/functional/feature_mandatory_coinbase.py index b942afb9eb..64f76b04cf 100755 --- a/test/functional/feature_mandatory_coinbase.py +++ b/test/functional/feature_mandatory_coinbase.py @@ -64,10 +64,11 @@ class MandatoryCoinbaseTest(BitcoinTestFramework): block.proof = CProof(bytearray.fromhex('51')) block.vtx = [coinbase_tx] block.block_height = int(tmpl["height"]) + block.hashMerkleRoot = block.calc_merkle_root() self.log.info("getblocktemplate: Test block on both nodes") - assert_equal(node0.submitblock(b2x(block.serialize())), 'invalid') assert_template(node1, block, None) + assert_template(node0, block, 'bad-coinbase-txos') self.log.info("getblocktemplate: Test non-subsidy block on both nodes") # Without block reward anything goes, this allows commitment outputs like segwit diff --git a/test/functional/mining_basic.py b/test/functional/mining_basic.py index 1d0f7e7b01..fce41b3ca8 100755 --- a/test/functional/mining_basic.py +++ b/test/functional/mining_basic.py @@ -156,8 +156,6 @@ class MiningTest(BitcoinTestFramework): self.log.info('submitheader tests') assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='xx' * TX_COUNT_OFFSET)) assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='ff' * (TX_COUNT_OFFSET-2))) - import pdb - pdb.set_trace() assert_raises_rpc_error(-25, 'Must submit previous header', lambda: node.submitheader(hexdata=super(CBlock, bad_block).serialize().hex())) block.nTime += 1 diff --git a/test/functional/p2p_invalid_block.py b/test/functional/p2p_invalid_block.py index b2bb2e1df9..da651d66bc 100755 --- a/test/functional/p2p_invalid_block.py +++ b/test/functional/p2p_invalid_block.py @@ -92,7 +92,7 @@ class InvalidBlockRequestTest(BitcoinTestFramework): block2_orig.hashMerkleRoot = block2_orig.calc_merkle_root() block2_orig.rehash() block2_orig.solve() - node.p2p.send_blocks_and_test([block2_orig], node, success=False, request_block=False, reject_reason=b'bad-txns-inputs-duplicate') + node.p2p.send_blocks_and_test([block2_orig], node, success=False, request_block=False, reject_reason='bad-txns-inputs-duplicate') self.log.info("Test very broken block.") diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 85d96228fc..5af1f24261 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -250,7 +250,7 @@ class TestNode(): @contextlib.contextmanager def assert_debug_log(self, expected_msgs): - debug_log = os.path.join(self.datadir, 'regtest', 'debug.log') + debug_log = os.path.join(self.datadir, 'regtest2', 'debug.log') with open(debug_log, encoding='utf-8') as dl: dl.seek(0, 2) prev_size = dl.tell() diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index c06f7109e6..117e5c3884 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -163,7 +163,6 @@ BASE_SCRIPTS = [ 'rpc_uptime.py', 'wallet_resendwallettransactions.py', 'wallet_fallbackfee.py', - 'feature_minchainwork.py', 'rpc_getblockstats.py', 'p2p_fingerprint.py', 'feature_uacomment.py',