@@ -209,6 +209,7 @@ def create_bip112txs(self, bip112inputs, varyOP_CSV, txversion, locktime_delta=0
209209 return txs
210210
211211 def get_tests (self ):
212+ self .log .info ("Generate blocks in the past for coinbase outputs." )
212213 long_past_time = int (time .time ()) - 600 * 1000 # enough to build up to 1000 blocks 10 minutes apart without worrying about getting into the future
213214 self .nodes [0 ].setmocktime (long_past_time - 100 ) # enough so that the generated blocks will still all be before long_past_time
214215 self .coinbase_blocks = self .nodes [0 ].generate (1 + 16 + 2 * 32 + 1 ) # 82 blocks generated for inputs
@@ -218,33 +219,39 @@ def get_tests(self):
218219 self .tip = int (self .nodes [0 ].getbestblockhash (), 16 )
219220 self .nodeaddress = self .nodes [0 ].getnewaddress ()
220221
222+ self .log .info ("Test that the csv softfork is DEFINED" )
221223 assert_equal (get_bip9_status (self .nodes [0 ], 'csv' )['status' ], 'defined' )
222224 test_blocks = self .generate_blocks (61 , 4 )
223225 yield TestInstance (test_blocks , sync_every_block = False )
224- # Advanced from DEFINED to STARTED, height = 143
226+
227+ self .log .info ("Advance from DEFINED to STARTED, height = 143" )
225228 assert_equal (get_bip9_status (self .nodes [0 ], 'csv' )['status' ], 'started' )
226229
227- # Fail to achieve LOCKED_IN 100 out of 144 signal bit 0
228- # using a variety of bits to simulate multiple parallel softforks
230+ self .log .info ("Fail to achieve LOCKED_IN" )
231+ # 100 out of 144 signal bit 0. Use a variety of bits to simulate multiple parallel softforks
232+
229233 test_blocks = self .generate_blocks (50 , 536870913 ) # 0x20000001 (signalling ready)
230234 test_blocks = self .generate_blocks (20 , 4 , test_blocks ) # 0x00000004 (signalling not)
231235 test_blocks = self .generate_blocks (50 , 536871169 , test_blocks ) # 0x20000101 (signalling ready)
232236 test_blocks = self .generate_blocks (24 , 536936448 , test_blocks ) # 0x20010000 (signalling not)
233237 yield TestInstance (test_blocks , sync_every_block = False )
234- # Failed to advance past STARTED, height = 287
238+
239+ self .log .info ("Failed to advance past STARTED, height = 287" )
235240 assert_equal (get_bip9_status (self .nodes [0 ], 'csv' )['status' ], 'started' )
236241
242+ self .log .info ("Generate blocks to achieve LOCK-IN" )
237243 # 108 out of 144 signal bit 0 to achieve lock-in
238244 # using a variety of bits to simulate multiple parallel softforks
239245 test_blocks = self .generate_blocks (58 , 536870913 ) # 0x20000001 (signalling ready)
240246 test_blocks = self .generate_blocks (26 , 4 , test_blocks ) # 0x00000004 (signalling not)
241247 test_blocks = self .generate_blocks (50 , 536871169 , test_blocks ) # 0x20000101 (signalling ready)
242248 test_blocks = self .generate_blocks (10 , 536936448 , test_blocks ) # 0x20010000 (signalling not)
243249 yield TestInstance (test_blocks , sync_every_block = False )
244- # Advanced from STARTED to LOCKED_IN, height = 431
250+
251+ self .log .info ("Advanced from STARTED to LOCKED_IN, height = 431" )
245252 assert_equal (get_bip9_status (self .nodes [0 ], 'csv' )['status' ], 'locked_in' )
246253
247- # 140 more version 4 blocks
254+ # Generate 140 more version 4 blocks
248255 test_blocks = self .generate_blocks (140 , 4 )
249256 yield TestInstance (test_blocks , sync_every_block = False )
250257
@@ -256,22 +263,26 @@ def get_tests(self):
256263 bip68inputs = []
257264 for i in range (16 ):
258265 bip68inputs .append (self .send_generic_input_tx (self .nodes [0 ], self .coinbase_blocks ))
266+
259267 # 2 sets of 16 inputs with 10 OP_CSV OP_DROP (actually will be prepended to spending scriptSig)
260268 bip112basicinputs = []
261269 for j in range (2 ):
262270 inputs = []
263271 for i in range (16 ):
264272 inputs .append (self .send_generic_input_tx (self .nodes [0 ], self .coinbase_blocks ))
265273 bip112basicinputs .append (inputs )
274+
266275 # 2 sets of 16 varied inputs with (relative_lock_time) OP_CSV OP_DROP (actually will be prepended to spending scriptSig)
267276 bip112diverseinputs = []
268277 for j in range (2 ):
269278 inputs = []
270279 for i in range (16 ):
271280 inputs .append (self .send_generic_input_tx (self .nodes [0 ], self .coinbase_blocks ))
272281 bip112diverseinputs .append (inputs )
282+
273283 # 1 special input with -1 OP_CSV OP_DROP (actually will be prepended to spending scriptSig)
274284 bip112specialinput = self .send_generic_input_tx (self .nodes [0 ], self .coinbase_blocks )
285+
275286 # 1 normal input
276287 bip113input = self .send_generic_input_tx (self .nodes [0 ], self .coinbase_blocks )
277288
@@ -286,7 +297,8 @@ def get_tests(self):
286297 # 2 more version 4 blocks
287298 test_blocks = self .generate_blocks (2 , 4 )
288299 yield TestInstance (test_blocks , sync_every_block = False )
289- # Not yet advanced to ACTIVE, height = 574 (will activate for block 576, not 575)
300+
301+ self .log .info ("Not yet advanced to ACTIVE, height = 574 (will activate for block 576, not 575)" )
290302 assert_equal (get_bip9_status (self .nodes [0 ], 'csv' )['status' ], 'locked_in' )
291303
292304 # Test both version 1 and version 2 transactions for all tests
@@ -319,13 +331,11 @@ def get_tests(self):
319331 bip112tx_special_v1 = self .create_bip112special (bip112specialinput , 1 )
320332 bip112tx_special_v2 = self .create_bip112special (bip112specialinput , 2 )
321333
334+ self .log .info ("TESTING" )
335+
336+ self .log .info ("Pre-Soft Fork Tests. All txs should pass." )
337+ self .log .info ("Test version 1 txs" )
322338
323- ### TESTING ###
324- ##################################
325- ### Before Soft Forks Activate ###
326- ##################################
327- # All txs should pass
328- ### Version 1 txs ###
329339 success_txs = []
330340 # add BIP113 tx and -1 CSV tx
331341 bip113tx_v1 .nLockTime = self .last_block_time - 600 * 5 # = MTP of prior block (not <) but < time put on current block
@@ -343,7 +353,8 @@ def get_tests(self):
343353 yield TestInstance ([[self .create_test_block (success_txs ), True ]])
344354 self .nodes [0 ].invalidateblock (self .nodes [0 ].getbestblockhash ())
345355
346- ### Version 2 txs ###
356+ self .log .info ("Test version 2 txs" )
357+
347358 success_txs = []
348359 # add BIP113 tx and -1 CSV tx
349360 bip113tx_v2 .nLockTime = self .last_block_time - 600 * 5 # = MTP of prior block (not <) but < time put on current block
@@ -366,10 +377,9 @@ def get_tests(self):
366377 yield TestInstance (test_blocks , sync_every_block = False )
367378 assert_equal (get_bip9_status (self .nodes [0 ], 'csv' )['status' ], 'active' )
368379
369- #################################
370- ### After Soft Forks Activate ###
371- #################################
372- ### BIP 113 ###
380+ self .log .info ("Post-Soft Fork Tests." )
381+
382+ self .log .info ("BIP 113 tests" )
373383 # BIP 113 tests should now fail regardless of version number if nLockTime isn't satisfied by new rules
374384 bip113tx_v1 .nLockTime = self .last_block_time - 600 * 5 # = MTP of prior block (not <) but < time put on current block
375385 bip113signed1 = self .sign_transaction (self .nodes [0 ], bip113tx_v1 )
@@ -390,15 +400,16 @@ def get_tests(self):
390400 test_blocks = self .generate_blocks (4 , 1234 )
391401 yield TestInstance (test_blocks , sync_every_block = False )
392402
393- ### BIP 68 ###
394- ### Version 1 txs ###
395- # All still pass
403+ self . log . info ( " BIP 68 tests" )
404+ self . log . info ( "Test version 1 txs - all should still pass" )
405+
396406 success_txs = []
397407 success_txs .extend (all_rlt_txs (bip68txs_v1 ))
398408 yield TestInstance ([[self .create_test_block (success_txs ), True ]])
399409 self .nodes [0 ].invalidateblock (self .nodes [0 ].getbestblockhash ())
400410
401- ### Version 2 txs ###
411+ self .log .info ("Test version 2 txs" )
412+
402413 bip68success_txs = []
403414 # All txs with SEQUENCE_LOCKTIME_DISABLE_FLAG set pass
404415 for b25 in range (2 ):
@@ -441,8 +452,9 @@ def get_tests(self):
441452 yield TestInstance ([[self .create_test_block (bip68success_txs ), True ]])
442453 self .nodes [0 ].invalidateblock (self .nodes [0 ].getbestblockhash ())
443454
444- ### BIP 112 ###
445- ### Version 1 txs ###
455+ self .log .info ("BIP 112 tests" )
456+ self .log .info ("Test version 1 txs" )
457+
446458 # -1 OP_CSV tx should fail
447459 yield TestInstance ([[self .create_test_block ([bip112tx_special_v1 ]), False ]])
448460 # If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in argument to OP_CSV, version 1 txs should still pass
@@ -468,7 +480,8 @@ def get_tests(self):
468480 for tx in fail_txs :
469481 yield TestInstance ([[self .create_test_block ([tx ]), False ]])
470482
471- ### Version 2 txs ###
483+ self .log .info ("Version 2 txs" )
484+
472485 # -1 OP_CSV tx should fail
473486 yield TestInstance ([[self .create_test_block ([bip112tx_special_v2 ]), False ]])
474487
0 commit comments