3636
3737"""
3838from test_framework .test_framework import BitcoinTestFramework
39- from test_framework .util import assert_equal , wait_until_helper
39+ from test_framework .util import assert_equal
4040
4141START_HEIGHT = 199
4242SNAPSHOT_BASE_HEIGHT = 299
@@ -80,16 +80,13 @@ def run_test(self):
8080
8181 self .sync_blocks ()
8282
83- def no_sync ():
84- pass
85-
8683 # Generate a series of blocks that `n0` will have in the snapshot,
8784 # but that n1 doesn't yet see. In order for the snapshot to activate,
8885 # though, we have to ferry over the new headers to n1 so that it
8986 # isn't waiting forever to see the header of the snapshot's base block
9087 # while disconnected from n0.
9188 for i in range (100 ):
92- self .generate (n0 , nblocks = 1 , sync_fun = no_sync )
89+ self .generate (n0 , nblocks = 1 , sync_fun = self . no_op )
9390 newblock = n0 .getblock (n0 .getbestblockhash (), 0 )
9491
9592 # make n1 aware of the new header, but don't give it the block.
@@ -116,7 +113,7 @@ def no_sync():
116113
117114 # Mine more blocks on top of the snapshot that n1 hasn't yet seen. This
118115 # will allow us to test n1's sync-to-tip on top of a snapshot.
119- self .generate (n0 , nblocks = 100 , sync_fun = no_sync )
116+ self .generate (n0 , nblocks = 100 , sync_fun = self . no_op )
120117
121118 assert_equal (n0 .getblockcount (), FINAL_HEIGHT )
122119 assert_equal (n1 .getblockcount (), START_HEIGHT )
@@ -162,11 +159,11 @@ def no_sync():
162159 self .connect_nodes (0 , 1 )
163160
164161 self .log .info (f"Ensuring snapshot chain syncs to tip. ({ FINAL_HEIGHT } )" )
165- wait_until_helper (lambda : n1 .getchainstates ()['chainstates' ][- 1 ]['blocks' ] == FINAL_HEIGHT )
162+ self . wait_until (lambda : n1 .getchainstates ()['chainstates' ][- 1 ]['blocks' ] == FINAL_HEIGHT )
166163 self .sync_blocks (nodes = (n0 , n1 ))
167164
168165 self .log .info ("Ensuring background validation completes" )
169- wait_until_helper (lambda : len (n1 .getchainstates ()['chainstates' ]) == 1 )
166+ self . wait_until (lambda : len (n1 .getchainstates ()['chainstates' ]) == 1 )
170167
171168 # Ensure indexes have synced.
172169 completed_idx_state = {
@@ -211,11 +208,11 @@ def no_sync():
211208 assert_equal (snapshot ['validated' ], False )
212209
213210 self .connect_nodes (0 , 2 )
214- wait_until_helper (lambda : n2 .getchainstates ()['chainstates' ][- 1 ]['blocks' ] == FINAL_HEIGHT )
211+ self . wait_until (lambda : n2 .getchainstates ()['chainstates' ][- 1 ]['blocks' ] == FINAL_HEIGHT )
215212 self .sync_blocks ()
216213
217214 self .log .info ("Ensuring background validation completes" )
218- wait_until_helper (lambda : len (n2 .getchainstates ()['chainstates' ]) == 1 )
215+ self . wait_until (lambda : len (n2 .getchainstates ()['chainstates' ]) == 1 )
219216
220217 completed_idx_state = {
221218 'basic block filter index' : COMPLETE_IDX ,
@@ -242,12 +239,12 @@ def no_sync():
242239 self .restart_node (2 , extra_args = [
243240 '-reindex-chainstate=1' , * self .extra_args [2 ]])
244241 assert_equal (n2 .getblockchaininfo ()["blocks" ], FINAL_HEIGHT )
245- wait_until_helper (lambda : n2 .getblockcount () == FINAL_HEIGHT )
242+ self . wait_until (lambda : n2 .getblockcount () == FINAL_HEIGHT )
246243
247244 self .log .info ("Test -reindex of an assumeutxo-synced node" )
248245 self .restart_node (2 , extra_args = ['-reindex=1' , * self .extra_args [2 ]])
249246 self .connect_nodes (0 , 2 )
250- wait_until_helper (lambda : n2 .getblockcount () == FINAL_HEIGHT )
247+ self . wait_until (lambda : n2 .getblockcount () == FINAL_HEIGHT )
251248
252249
253250if __name__ == '__main__' :
0 commit comments