@@ -22,6 +22,8 @@ def set_test_params(self):
2222
2323 def run_test (self ):
2424
25+ self .log .info ("Wait for dip0008 activation" )
26+
2527 while self .nodes [0 ].getblockchaininfo ()["bip9_softforks" ]["dip0008" ]["status" ] != "active" :
2628 self .nodes [0 ].generate (10 )
2729 sync_blocks (self .nodes , timeout = 60 * 5 )
@@ -30,97 +32,100 @@ def run_test(self):
3032 self .nodes [0 ].spork ("SPORK_19_CHAINLOCKS_ENABLED" , 0 )
3133 self .wait_for_sporks_same ()
3234
35+ self .log .info ("Mining 4 quorums" )
3336 for i in range (4 ):
3437 self .mine_quorum ()
3538
36- # mine single block, wait for chainlock
39+ self . log . info ( "Mine single block, wait for chainlock" )
3740 self .nodes [0 ].generate (1 )
38- self .wait_for_chainlocked_tip_all_nodes ( )
41+ self .wait_for_chainlocked_block_all_nodes ( self . nodes [ 0 ]. getbestblockhash () )
3942
40- # mine many blocks, wait for chainlock
43+ self . log . info ( "Mine many blocks, wait for chainlock" )
4144 self .nodes [0 ].generate (20 )
42- self .wait_for_chainlocked_tip_all_nodes ()
45+ # We need more time here due to 20 blocks being generated at once
46+ self .wait_for_chainlocked_block_all_nodes (self .nodes [0 ].getbestblockhash (), timeout = 30 )
4347
44- # assert that all blocks up until the tip are chainlocked
48+ self . log . info ( "Assert that all blocks up until the tip are chainlocked" )
4549 for h in range (1 , self .nodes [0 ].getblockcount ()):
4650 block = self .nodes [0 ].getblock (self .nodes [0 ].getblockhash (h ))
4751 assert (block ['chainlock' ])
4852
49- # Isolate node, mine on another, and reconnect
53+ self . log . info ( " Isolate node, mine on another, and reconnect" )
5054 isolate_node (self .nodes [0 ])
5155 node0_mining_addr = self .nodes [0 ].getnewaddress ()
5256 node0_tip = self .nodes [0 ].getbestblockhash ()
5357 self .nodes [1 ].generatetoaddress (5 , node0_mining_addr )
54- self .wait_for_chainlocked_tip (self .nodes [1 ])
58+ self .wait_for_chainlocked_block (self .nodes [1 ], self . nodes [ 1 ]. getbestblockhash () )
5559 assert (self .nodes [0 ].getbestblockhash () == node0_tip )
5660 reconnect_isolated_node (self .nodes [0 ], 1 )
5761 self .nodes [1 ].generatetoaddress (1 , node0_mining_addr )
5862 self .wait_for_chainlocked_block (self .nodes [0 ], self .nodes [1 ].getbestblockhash ())
5963
60- # Isolate node, mine on both parts of the network, and reconnect
64+ self . log . info ( " Isolate node, mine on both parts of the network, and reconnect" )
6165 isolate_node (self .nodes [0 ])
6266 self .nodes [0 ].generate (5 )
6367 self .nodes [1 ].generatetoaddress (1 , node0_mining_addr )
6468 good_tip = self .nodes [1 ].getbestblockhash ()
65- self .wait_for_chainlocked_tip (self .nodes [1 ])
69+ self .wait_for_chainlocked_block (self .nodes [1 ], good_tip )
6670 assert (not self .nodes [0 ].getblock (self .nodes [0 ].getbestblockhash ())["chainlock" ])
6771 reconnect_isolated_node (self .nodes [0 ], 1 )
6872 self .nodes [1 ].generatetoaddress (1 , node0_mining_addr )
6973 self .wait_for_chainlocked_block (self .nodes [0 ], self .nodes [1 ].getbestblockhash ())
7074 assert (self .nodes [0 ].getblock (self .nodes [0 ].getbestblockhash ())["previousblockhash" ] == good_tip )
7175 assert (self .nodes [1 ].getblock (self .nodes [1 ].getbestblockhash ())["previousblockhash" ] == good_tip )
7276
73- # Keep node connected and let it try to reorg the chain
77+ self . log . info ( " Keep node connected and let it try to reorg the chain" )
7478 good_tip = self .nodes [0 ].getbestblockhash ()
75- # Restart it so that it forgets all the chainlocks from the past
79+ self . log . info ( " Restart it so that it forgets all the chainlocks from the past" )
7680 self .stop_node (0 )
7781 self .start_node (0 )
7882 connect_nodes (self .nodes [0 ], 1 )
7983 self .nodes [0 ].invalidateblock (self .nodes [0 ].getbestblockhash ())
80- # Now try to reorg the chain
84+ self . log . info ( " Now try to reorg the chain" )
8185 self .nodes [0 ].generate (2 )
8286 time .sleep (6 )
8387 assert (self .nodes [1 ].getbestblockhash () == good_tip )
8488 self .nodes [0 ].generate (2 )
8589 time .sleep (6 )
8690 assert (self .nodes [1 ].getbestblockhash () == good_tip )
8791
88- # Now let the node which is on the wrong chain reorg back to the locked chain
92+ self . log . info ( " Now let the node which is on the wrong chain reorg back to the locked chain" )
8993 self .nodes [0 ].reconsiderblock (good_tip )
9094 assert (self .nodes [0 ].getbestblockhash () != good_tip )
9195 self .nodes [1 ].generatetoaddress (1 , node0_mining_addr )
9296 self .wait_for_chainlocked_block (self .nodes [0 ], self .nodes [1 ].getbestblockhash ())
9397 assert (self .nodes [0 ].getbestblockhash () == self .nodes [1 ].getbestblockhash ())
9498
95- # Enable LLMQ bases InstantSend, which also enables checks for "safe" transactions
99+ self . log . info ( " Enable LLMQ bases InstantSend, which also enables checks for \ " safe\ " transactions" )
96100 self .nodes [0 ].spork ("SPORK_2_INSTANTSEND_ENABLED" , 0 )
97101 self .nodes [0 ].spork ("SPORK_3_INSTANTSEND_BLOCK_FILTERING" , 0 )
98102 self .wait_for_sporks_same ()
99103
100- # Isolate a node and let it create some transactions which won't get IS locked
104+ self . log . info ( " Isolate a node and let it create some transactions which won't get IS locked" )
101105 isolate_node (self .nodes [0 ])
102106 txs = []
103107 for i in range (3 ):
104108 txs .append (self .nodes [0 ].sendtoaddress (self .nodes [0 ].getnewaddress (), 1 ))
105109 txs += self .create_chained_txs (self .nodes [0 ], 1 )
106- # Assert that after block generation these TXs are NOT included (as they are "unsafe")
110+ self . log . info ( " Assert that after block generation these TXs are NOT included (as they are \ " unsafe\" ) " )
107111 self .nodes [0 ].generate (1 )
108112 for txid in txs :
109113 tx = self .nodes [0 ].getrawtransaction (txid , 1 )
110114 assert ("confirmations" not in tx )
111115 time .sleep (1 )
112116 assert (not self .nodes [0 ].getblock (self .nodes [0 ].getbestblockhash ())["chainlock" ])
113- # Disable LLMQ based InstantSend for a very short time (this never gets propagated to other nodes)
117+ self . log . info ( " Disable LLMQ based InstantSend for a very short time (this never gets propagated to other nodes)" )
114118 self .nodes [0 ].spork ("SPORK_2_INSTANTSEND_ENABLED" , 4070908800 )
115- # Now the TXs should be included
119+ self . log . info ( " Now the TXs should be included" )
116120 self .nodes [0 ].generate (1 )
117121 self .nodes [0 ].spork ("SPORK_2_INSTANTSEND_ENABLED" , 0 )
118- # Assert that TXs got included now
122+ self . log . info ( " Assert that TXs got included now" )
119123 for txid in txs :
120124 tx = self .nodes [0 ].getrawtransaction (txid , 1 )
121125 assert ("confirmations" in tx and tx ["confirmations" ] > 0 )
122126 # Enable network on first node again, which will cause the blocks to propagate and IS locks to happen retroactively
123127 # for the mined TXs, which will then allow the network to create a CLSIG
128+ self .log .info ("Reenable network on first node and wait for chainlock" )
124129 reconnect_isolated_node (self .nodes [0 ], 1 )
125130 self .wait_for_chainlocked_block (self .nodes [0 ], self .nodes [0 ].getbestblockhash (), 30 )
126131
0 commit comments