diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/feature_block.py | 5 | ||||
-rwxr-xr-x | test/functional/mempool_accept_wtxid.py | 11 | ||||
-rwxr-xr-x | test/functional/p2p_addr_relay.py | 2 | ||||
-rwxr-xr-x | test/functional/rpc_blockchain.py | 2 | ||||
-rw-r--r-- | test/functional/test_framework/blocktools.py | 3 | ||||
-rwxr-xr-x | test/functional/test_framework/messages.py | 2 |
6 files changed, 13 insertions, 12 deletions
diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py index 227be16487..777787ed32 100755 --- a/test/functional/feature_block.py +++ b/test/functional/feature_block.py @@ -373,7 +373,9 @@ class FullBlockTest(BitcoinTestFramework): # b30 has a max-sized coinbase scriptSig. self.move_tip(23) b30 = self.next_block(30) - b30.vtx[0].vin[0].scriptSig = b'\x00' * 100 + b30.vtx[0].vin[0].scriptSig = bytes(b30.vtx[0].vin[0].scriptSig) # Convert CScript to raw bytes + b30.vtx[0].vin[0].scriptSig += b'\x00' * (100 - len(b30.vtx[0].vin[0].scriptSig)) # Fill with 0s + assert_equal(len(b30.vtx[0].vin[0].scriptSig), 100) b30.vtx[0].rehash() b30 = self.update_block(30, []) self.send_blocks([b30], True) @@ -833,6 +835,7 @@ class FullBlockTest(BitcoinTestFramework): b61.vtx[0].rehash() b61 = self.update_block(61, []) assert_equal(duplicate_tx.serialize(), b61.vtx[0].serialize()) + # BIP30 is always checked on regtest, regardless of the BIP34 activation height self.send_blocks([b61], success=False, reject_reason='bad-txns-BIP30', reconnect=True) # Test BIP30 (allow duplicate if spent) diff --git a/test/functional/mempool_accept_wtxid.py b/test/functional/mempool_accept_wtxid.py index 63ecc8ee2a..ffafe7428f 100755 --- a/test/functional/mempool_accept_wtxid.py +++ b/test/functional/mempool_accept_wtxid.py @@ -4,9 +4,10 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Test mempool acceptance in case of an already known transaction -with identical non-witness data different witness. +with identical non-witness data but different witness. """ +from copy import deepcopy from test_framework.messages import ( COIN, COutPoint, @@ -79,10 +80,7 @@ class MempoolWtxidTest(BitcoinTestFramework): child_one_txid = child_one.rehash() # Create another identical transaction with witness solving second branch - child_two = CTransaction() - child_two.vin.append(CTxIn(COutPoint(int(parent_txid, 16), 0), b"")) - child_two.vout.append(CTxOut(int(9.99996 * COIN), child_script_pubkey)) - child_two.wit.vtxinwit.append(CTxInWitness()) + child_two = deepcopy(child_one) child_two.wit.vtxinwit[0].scriptWitness.stack = [b'', witness_script] child_two_wtxid = child_two.getwtxid() child_two_txid = child_two.rehash() @@ -104,8 +102,7 @@ class MempoolWtxidTest(BitcoinTestFramework): "allowed": False, "reject-reason": "txn-already-in-mempool" }]) - testres_child_two = node.testmempoolaccept([child_two.serialize().hex()])[0] - assert_equal(testres_child_two, { + assert_equal(node.testmempoolaccept([child_two.serialize().hex()])[0], { "txid": child_two_txid, "wtxid": child_two_wtxid, "allowed": False, diff --git a/test/functional/p2p_addr_relay.py b/test/functional/p2p_addr_relay.py index 95743a1bf5..113e1f9492 100755 --- a/test/functional/p2p_addr_relay.py +++ b/test/functional/p2p_addr_relay.py @@ -179,7 +179,7 @@ class AddrTest(BitcoinTestFramework): # of the outbound peer which is often sent before the GETADDR response. assert_equal(inbound_peer.num_ipv4_received, 0) - # Send an empty ADDR message to intialize address relay on this connection. + # Send an empty ADDR message to initialize address relay on this connection. inbound_peer.send_and_ping(msg_addr()) self.log.info('Check that subsequent addr messages sent from an outbound peer are relayed') diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py index 794b2e5e08..721e3f93a3 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -140,7 +140,7 @@ class BlockchainTest(BitcoinTestFramework): assert_greater_than(res['size_on_disk'], 0) assert_equal(res['softforks'], { - 'bip34': {'type': 'buried', 'active': False, 'height': 500}, + 'bip34': {'type': 'buried', 'active': True, 'height': 2}, 'bip66': {'type': 'buried', 'active': False, 'height': 1251}, 'bip65': {'type': 'buried', 'active': False, 'height': 1351}, 'csv': {'type': 'buried', 'active': False, 'height': 432}, diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py index 1a2d9e1864..52ca579b1b 100644 --- a/test/functional/test_framework/blocktools.py +++ b/test/functional/test_framework/blocktools.py @@ -61,6 +61,7 @@ CSV_ACTIVATION_HEIGHT = 432 WITNESS_COMMITMENT_HEADER = b"\xaa\x21\xa9\xed" NORMAL_GBT_REQUEST_PARAMS = {"rules": ["segwit"]} +VERSIONBITS_LAST_OLD_BLOCK_VERSION = 4 def create_block(hashprev=None, coinbase=None, ntime=None, *, version=None, tmpl=None, txlist=None): @@ -68,7 +69,7 @@ def create_block(hashprev=None, coinbase=None, ntime=None, *, version=None, tmpl block = CBlock() if tmpl is None: tmpl = {} - block.nVersion = version or tmpl.get('version') or 1 + block.nVersion = version or tmpl.get('version') or VERSIONBITS_LAST_OLD_BLOCK_VERSION block.nTime = ntime or tmpl.get('curtime') or int(time.time() + 600) block.hashPrevBlock = hashprev or int(tmpl['previousblockhash'], 0x10) if tmpl and not tmpl.get('bits') is None: diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 57a2c7da47..6e57107f86 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -642,7 +642,7 @@ class CBlockHeader: self.calc_sha256() def set_null(self): - self.nVersion = 1 + self.nVersion = 4 self.hashPrevBlock = 0 self.hashMerkleRoot = 0 self.nTime = 0 |