12
12
[Consensus] Check that the new NULLDUMMY rules are not enforced on the 431st block.
13
13
[Policy/Consensus] Check that the new NULLDUMMY rules are enforced on the 432nd block.
14
14
"""
15
+ import time
15
16
16
17
from test_framework .blocktools import create_coinbase , create_block , create_transaction , add_witness_commitment
17
18
from test_framework .messages import CTransaction
18
19
from test_framework .script import CScript
19
20
from test_framework .test_framework import BitcoinTestFramework
20
21
from test_framework .util import assert_equal , assert_raises_rpc_error , bytes_to_hex_str
21
22
22
- import time
23
-
24
23
NULLDUMMY_ERROR = "non-mandatory-script-verify-flag (Dummy CHECKMULTISIG argument must be zero) (code 64)"
25
24
26
25
def trueDummy (tx ):
@@ -53,11 +52,11 @@ def run_test(self):
53
52
self .wit_address = self .nodes [0 ].addwitnessaddress (self .address )
54
53
self .wit_ms_address = self .nodes [0 ].addmultisigaddress (1 , [self .address ], '' , 'p2sh-segwit' )['address' ]
55
54
56
- self .coinbase_blocks = self .nodes [0 ].generate (2 ) # Block 2
55
+ self .coinbase_blocks = self .nodes [0 ].generate (2 ) # Block 2
57
56
coinbase_txid = []
58
57
for i in self .coinbase_blocks :
59
58
coinbase_txid .append (self .nodes [0 ].getblock (i )['tx' ][0 ])
60
- self .nodes [0 ].generate (427 ) # Block 429
59
+ self .nodes [0 ].generate (427 ) # Block 429
61
60
self .lastblockhash = self .nodes [0 ].getbestblockhash ()
62
61
self .tip = int ("0x" + self .lastblockhash , 0 )
63
62
self .lastblockheight = 429
@@ -82,7 +81,7 @@ def run_test(self):
82
81
83
82
self .log .info ("Test 4: Non-NULLDUMMY base multisig transaction is invalid after activation" )
84
83
test4tx = create_transaction (self .nodes [0 ], test2tx .hash , self .address , amount = 46 )
85
- test6txs = [CTransaction (test4tx )]
84
+ test6txs = [CTransaction (test4tx )]
86
85
trueDummy (test4tx )
87
86
assert_raises_rpc_error (- 26 , NULLDUMMY_ERROR , self .nodes [0 ].sendrawtransaction , bytes_to_hex_str (test4tx .serialize_with_witness ()), True )
88
87
self .block_submit (self .nodes [0 ], [test4tx ])
@@ -99,8 +98,7 @@ def run_test(self):
99
98
self .nodes [0 ].sendrawtransaction (bytes_to_hex_str (i .serialize_with_witness ()), True )
100
99
self .block_submit (self .nodes [0 ], test6txs , True , True )
101
100
102
-
103
- def block_submit (self , node , txs , witness = False , accept = False ):
101
+ def block_submit (self , node , txs , witness = False , accept = False ):
104
102
block = create_block (self .tip , create_coinbase (self .lastblockheight + 1 ), self .lastblocktime + 1 )
105
103
block .nVersion = 4
106
104
for tx in txs :
0 commit comments