@@ -118,18 +118,22 @@ def run_test(self):
118
118
self .coinbase_txids = [self .nodes [0 ].getblock (b )['tx' ][0 ] for b in self .nodes [0 ].generate (CLTV_HEIGHT - 2 )]
119
119
self .nodeaddress = self .nodes [0 ].getnewaddress ()
120
120
121
- self .log .info ("Test that an invalid-according-to-CLTV transaction can still appear in a block" )
121
+ self .log .info ("Test that invalid-according-to-CLTV transactions can still appear in a block" )
122
122
123
- spendtx = create_transaction (self .nodes [0 ], self .coinbase_txids [0 ],
124
- self .nodeaddress , amount = 1.0 )
125
- spendtx = cltv_invalidate (self .nodes [0 ], spendtx , 1 )
126
- spendtx .rehash ()
123
+ # create one invalid tx per CLTV failure reason (5 in total) and collect them
124
+ invalid_ctlv_txs = []
125
+ for i in range (5 ):
126
+ spendtx = create_transaction (self .nodes [0 ], self .coinbase_txids [i ],
127
+ self .nodeaddress , amount = 1.0 )
128
+ spendtx = cltv_invalidate (self .nodes [0 ], spendtx , i )
129
+ spendtx .rehash ()
130
+ invalid_ctlv_txs .append (spendtx )
127
131
128
132
tip = self .nodes [0 ].getbestblockhash ()
129
133
block_time = self .nodes [0 ].getblockheader (tip )['mediantime' ] + 1
130
134
block = create_block (int (tip , 16 ), create_coinbase (CLTV_HEIGHT - 1 ), block_time )
131
135
block .nVersion = 3
132
- block .vtx .append ( spendtx )
136
+ block .vtx .extend ( invalid_ctlv_txs )
133
137
block .hashMerkleRoot = block .calc_merkle_root ()
134
138
block .solve ()
135
139
@@ -153,7 +157,7 @@ def run_test(self):
153
157
self .log .info ("Test that invalid-according-to-cltv transactions cannot appear in a block" )
154
158
block .nVersion = 4
155
159
156
- spendtx = create_transaction (self .nodes [0 ], self .coinbase_txids [1 ],
160
+ spendtx = create_transaction (self .nodes [0 ], self .coinbase_txids [10 ],
157
161
self .nodeaddress , amount = 1.0 )
158
162
spendtx = cltv_invalidate (self .nodes [0 ], spendtx , 1 )
159
163
spendtx .rehash ()
0 commit comments