@@ -161,7 +161,7 @@ def run_test(self):
161
161
162
162
self .log .info (f"Reject block with invalid tx: { TxTemplate .__name__ } " )
163
163
blockname = f"for_invalid.{ TxTemplate .__name__ } "
164
- badblock = self .next_block (blockname )
164
+ self .next_block (blockname )
165
165
badtx = template .get_tx ()
166
166
if TxTemplate != invalid_txs .InputMissing :
167
167
self .sign_tx (badtx , attempt_spend_tx )
@@ -473,7 +473,7 @@ def run_test(self):
473
473
#
474
474
self .log .info ("Check P2SH SIGOPS are correctly counted" )
475
475
self .move_tip (35 )
476
- b39 = self .next_block (39 )
476
+ self .next_block (39 )
477
477
b39_outputs = 0
478
478
b39_sigops_per_output = 6
479
479
@@ -672,7 +672,7 @@ def run_test(self):
672
672
673
673
self .log .info ("Reject a block with two coinbase transactions" )
674
674
self .move_tip (44 )
675
- b51 = self .next_block (51 )
675
+ self .next_block (51 )
676
676
cb2 = create_coinbase (51 , self .coinbase_pubkey )
677
677
b51 = self .update_block (51 , [cb2 ])
678
678
self .send_blocks ([b51 ], success = False , reject_reason = 'bad-cb-multiple' , reconnect = True )
@@ -752,7 +752,7 @@ def run_test(self):
752
752
753
753
# b57 - a good block with 2 txs, don't submit until end
754
754
self .move_tip (55 )
755
- b57 = self .next_block (57 )
755
+ self .next_block (57 )
756
756
tx = self .create_and_sign_transaction (out [16 ], 1 )
757
757
tx1 = self .create_tx (tx , 0 , 1 )
758
758
b57 = self .update_block (57 , [tx , tx1 ])
@@ -769,7 +769,7 @@ def run_test(self):
769
769
770
770
# b57p2 - a good block with 6 tx'es, don't submit until end
771
771
self .move_tip (55 )
772
- b57p2 = self .next_block ("57p2" )
772
+ self .next_block ("57p2" )
773
773
tx = self .create_and_sign_transaction (out [16 ], 1 )
774
774
tx1 = self .create_tx (tx , 0 , 1 )
775
775
tx2 = self .create_tx (tx1 , 0 , 1 )
@@ -803,7 +803,7 @@ def run_test(self):
803
803
# tx with prevout.n out of range
804
804
self .log .info ("Reject a block with a transaction with prevout.n out of range" )
805
805
self .move_tip (57 )
806
- b58 = self .next_block (58 , spend = out [17 ])
806
+ self .next_block (58 , spend = out [17 ])
807
807
tx = CTransaction ()
808
808
assert len (out [17 ].vout ) < 42
809
809
tx .vin .append (CTxIn (COutPoint (out [17 ].sha256 , 42 ), CScript ([OP_TRUE ]), SEQUENCE_FINAL ))
@@ -815,7 +815,7 @@ def run_test(self):
815
815
# tx with output value > input value
816
816
self .log .info ("Reject a block with a transaction with outputs > inputs" )
817
817
self .move_tip (57 )
818
- b59 = self .next_block (59 )
818
+ self .next_block (59 )
819
819
tx = self .create_and_sign_transaction (out [17 ], 51 * COIN )
820
820
b59 = self .update_block (59 , [tx ])
821
821
self .send_blocks ([b59 ], success = False , reject_reason = 'bad-txns-in-belowout' , reconnect = True )
@@ -851,7 +851,7 @@ def run_test(self):
851
851
# \-> b_spend_dup_cb (b_dup_cb) -> b_dup_2 ()
852
852
#
853
853
self .move_tip (57 )
854
- b_spend_dup_cb = self .next_block ('spend_dup_cb' )
854
+ self .next_block ('spend_dup_cb' )
855
855
tx = CTransaction ()
856
856
tx .vin .append (CTxIn (COutPoint (duplicate_tx .sha256 , 0 )))
857
857
tx .vout .append (CTxOut (0 , CScript ([OP_TRUE ])))
@@ -876,7 +876,7 @@ def run_test(self):
876
876
#
877
877
self .log .info ("Reject a block with a transaction with a nonfinal locktime" )
878
878
self .move_tip ('dup_2' )
879
- b62 = self .next_block (62 )
879
+ self .next_block (62 )
880
880
tx = CTransaction ()
881
881
tx .nLockTime = 0xffffffff # this locktime is non-final
882
882
tx .vin .append (CTxIn (COutPoint (out [18 ].sha256 , 0 ))) # don't set nSequence
@@ -957,7 +957,7 @@ def run_test(self):
957
957
#
958
958
self .log .info ("Accept a block with a transaction spending an output created in the same block" )
959
959
self .move_tip (64 )
960
- b65 = self .next_block (65 )
960
+ self .next_block (65 )
961
961
tx1 = self .create_and_sign_transaction (out [19 ], out [19 ].vout [0 ].nValue )
962
962
tx2 = self .create_and_sign_transaction (tx1 , 0 )
963
963
b65 = self .update_block (65 , [tx1 , tx2 ])
@@ -970,7 +970,7 @@ def run_test(self):
970
970
# \-> b66 (20)
971
971
self .log .info ("Reject a block with a transaction spending an output created later in the same block" )
972
972
self .move_tip (65 )
973
- b66 = self .next_block (66 )
973
+ self .next_block (66 )
974
974
tx1 = self .create_and_sign_transaction (out [20 ], out [20 ].vout [0 ].nValue )
975
975
tx2 = self .create_and_sign_transaction (tx1 , 1 )
976
976
b66 = self .update_block (66 , [tx2 , tx1 ])
@@ -984,7 +984,7 @@ def run_test(self):
984
984
#
985
985
self .log .info ("Reject a block with a transaction double spending a transaction created in the same block" )
986
986
self .move_tip (65 )
987
- b67 = self .next_block (67 )
987
+ self .next_block (67 )
988
988
tx1 = self .create_and_sign_transaction (out [20 ], out [20 ].vout [0 ].nValue )
989
989
tx2 = self .create_and_sign_transaction (tx1 , 1 )
990
990
tx3 = self .create_and_sign_transaction (tx1 , 2 )
@@ -1005,7 +1005,7 @@ def run_test(self):
1005
1005
#
1006
1006
self .log .info ("Reject a block trying to claim too much subsidy in the coinbase transaction" )
1007
1007
self .move_tip (65 )
1008
- b68 = self .next_block (68 , additional_coinbase_value = 10 )
1008
+ self .next_block (68 , additional_coinbase_value = 10 )
1009
1009
tx = self .create_and_sign_transaction (out [20 ], out [20 ].vout [0 ].nValue - 9 )
1010
1010
b68 = self .update_block (68 , [tx ])
1011
1011
self .send_blocks ([b68 ], success = False , reject_reason = 'bad-cb-amount' , reconnect = True )
@@ -1025,7 +1025,7 @@ def run_test(self):
1025
1025
#
1026
1026
self .log .info ("Reject a block containing a transaction spending from a non-existent input" )
1027
1027
self .move_tip (69 )
1028
- b70 = self .next_block (70 , spend = out [21 ])
1028
+ self .next_block (70 , spend = out [21 ])
1029
1029
bogus_tx = CTransaction ()
1030
1030
bogus_tx .sha256 = uint256_from_str (b"23c70ed7c0506e9178fc1a987f40a33946d4ad4c962b5ae3a52546da53af0c5c" )
1031
1031
tx = CTransaction ()
@@ -1043,7 +1043,7 @@ def run_test(self):
1043
1043
# b71 is a copy of 72, but re-adds one of its transactions. However, it has the same hash as b72.
1044
1044
self .log .info ("Reject a block containing a duplicate transaction but with the same Merkle root (Merkle tree malleability" )
1045
1045
self .move_tip (69 )
1046
- b72 = self .next_block (72 )
1046
+ self .next_block (72 )
1047
1047
tx1 = self .create_and_sign_transaction (out [21 ], 2 )
1048
1048
tx2 = self .create_and_sign_transaction (tx1 , 1 )
1049
1049
b72 = self .update_block (72 , [tx1 , tx2 ]) # now tip is 72
@@ -1081,7 +1081,7 @@ def run_test(self):
1081
1081
# bytearray[20,526] : OP_CHECKSIG (this puts us over the limit)
1082
1082
self .log .info ("Reject a block containing too many sigops after a large script element" )
1083
1083
self .move_tip (72 )
1084
- b73 = self .next_block (73 )
1084
+ self .next_block (73 )
1085
1085
size = MAX_BLOCK_SIGOPS - 1 + MAX_SCRIPT_ELEMENT_SIZE + 1 + 5 + 1
1086
1086
a = bytearray ([OP_CHECKSIG ] * size )
1087
1087
a [MAX_BLOCK_SIGOPS - 1 ] = int ("4e" , 16 ) # OP_PUSHDATA4
@@ -1109,7 +1109,7 @@ def run_test(self):
1109
1109
# b75 succeeds because we put MAX_BLOCK_SIGOPS before the element
1110
1110
self .log .info ("Check sigops are counted correctly after an invalid script element" )
1111
1111
self .move_tip (72 )
1112
- b74 = self .next_block (74 )
1112
+ self .next_block (74 )
1113
1113
size = MAX_BLOCK_SIGOPS - 1 + MAX_SCRIPT_ELEMENT_SIZE + 42 # total = 20,561
1114
1114
a = bytearray ([OP_CHECKSIG ] * size )
1115
1115
a [MAX_BLOCK_SIGOPS ] = 0x4e
@@ -1122,7 +1122,7 @@ def run_test(self):
1122
1122
self .send_blocks ([b74 ], success = False , reject_reason = 'bad-blk-sigops' , reconnect = True )
1123
1123
1124
1124
self .move_tip (72 )
1125
- b75 = self .next_block (75 )
1125
+ self .next_block (75 )
1126
1126
size = MAX_BLOCK_SIGOPS - 1 + MAX_SCRIPT_ELEMENT_SIZE + 42
1127
1127
a = bytearray ([OP_CHECKSIG ] * size )
1128
1128
a [MAX_BLOCK_SIGOPS - 1 ] = 0x4e
@@ -1137,7 +1137,7 @@ def run_test(self):
1137
1137
1138
1138
# Check that if we push an element filled with CHECKSIGs, they are not counted
1139
1139
self .move_tip (75 )
1140
- b76 = self .next_block (76 )
1140
+ self .next_block (76 )
1141
1141
size = MAX_BLOCK_SIGOPS - 1 + MAX_SCRIPT_ELEMENT_SIZE + 1 + 5
1142
1142
a = bytearray ([OP_CHECKSIG ] * size )
1143
1143
a [MAX_BLOCK_SIGOPS - 1 ] = 0x4e # PUSHDATA4, but leave the following bytes as just checksigs
@@ -1165,18 +1165,18 @@ def run_test(self):
1165
1165
# updated. (Perhaps to spend to a P2SH OP_TRUE script)
1166
1166
self .log .info ("Test transaction resurrection during a re-org" )
1167
1167
self .move_tip (76 )
1168
- b77 = self .next_block (77 )
1168
+ self .next_block (77 )
1169
1169
tx77 = self .create_and_sign_transaction (out [24 ], 10 * COIN )
1170
1170
b77 = self .update_block (77 , [tx77 ])
1171
1171
self .send_blocks ([b77 ], True )
1172
1172
self .save_spendable_output ()
1173
1173
1174
- b78 = self .next_block (78 )
1174
+ self .next_block (78 )
1175
1175
tx78 = self .create_tx (tx77 , 0 , 9 * COIN )
1176
1176
b78 = self .update_block (78 , [tx78 ])
1177
1177
self .send_blocks ([b78 ], True )
1178
1178
1179
- b79 = self .next_block (79 )
1179
+ self .next_block (79 )
1180
1180
tx79 = self .create_tx (tx78 , 0 , 8 * COIN )
1181
1181
b79 = self .update_block (79 , [tx79 ])
1182
1182
self .send_blocks ([b79 ], True )
@@ -1208,7 +1208,7 @@ def run_test(self):
1208
1208
# -> b81 (26) -> b82 (27) -> b83 (28)
1209
1209
#
1210
1210
self .log .info ("Accept a block with invalid opcodes in dead execution paths" )
1211
- b83 = self .next_block (83 )
1211
+ self .next_block (83 )
1212
1212
op_codes = [OP_IF , OP_INVALIDOPCODE , OP_ELSE , OP_TRUE , OP_ENDIF ]
1213
1213
script = CScript (op_codes )
1214
1214
tx1 = self .create_and_sign_transaction (out [28 ], out [28 ].vout [0 ].nValue , script )
@@ -1227,7 +1227,7 @@ def run_test(self):
1227
1227
# \-> b85 (29) -> b86 (30) \-> b89a (32)
1228
1228
#
1229
1229
self .log .info ("Test re-orging blocks with OP_RETURN in them" )
1230
- b84 = self .next_block (84 )
1230
+ self .next_block (84 )
1231
1231
tx1 = self .create_tx (out [29 ], 0 , 0 , CScript ([OP_RETURN ]))
1232
1232
tx1 .vout .append (CTxOut (0 , CScript ([OP_TRUE ])))
1233
1233
tx1 .vout .append (CTxOut (0 , CScript ([OP_TRUE ])))
@@ -1265,7 +1265,7 @@ def run_test(self):
1265
1265
self .save_spendable_output ()
1266
1266
1267
1267
# trying to spend the OP_RETURN output is rejected
1268
- b89a = self .next_block ("89a" , spend = out [32 ])
1268
+ self .next_block ("89a" , spend = out [32 ])
1269
1269
tx = self .create_tx (tx1 , 0 , 0 , CScript ([OP_TRUE ]))
1270
1270
b89a = self .update_block ("89a" , [tx ])
1271
1271
self .send_blocks ([b89a ], success = False , reject_reason = 'bad-txns-inputs-missingorspent' , reconnect = True )
0 commit comments