36
36
37
37
"""
38
38
from 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
40
40
41
41
START_HEIGHT = 199
42
42
SNAPSHOT_BASE_HEIGHT = 299
@@ -80,16 +80,13 @@ def run_test(self):
80
80
81
81
self .sync_blocks ()
82
82
83
- def no_sync ():
84
- pass
85
-
86
83
# Generate a series of blocks that `n0` will have in the snapshot,
87
84
# but that n1 doesn't yet see. In order for the snapshot to activate,
88
85
# though, we have to ferry over the new headers to n1 so that it
89
86
# isn't waiting forever to see the header of the snapshot's base block
90
87
# while disconnected from n0.
91
88
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 )
93
90
newblock = n0 .getblock (n0 .getbestblockhash (), 0 )
94
91
95
92
# make n1 aware of the new header, but don't give it the block.
@@ -116,7 +113,7 @@ def no_sync():
116
113
117
114
# Mine more blocks on top of the snapshot that n1 hasn't yet seen. This
118
115
# 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 )
120
117
121
118
assert_equal (n0 .getblockcount (), FINAL_HEIGHT )
122
119
assert_equal (n1 .getblockcount (), START_HEIGHT )
@@ -162,11 +159,11 @@ def no_sync():
162
159
self .connect_nodes (0 , 1 )
163
160
164
161
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 )
166
163
self .sync_blocks (nodes = (n0 , n1 ))
167
164
168
165
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 )
170
167
171
168
# Ensure indexes have synced.
172
169
completed_idx_state = {
@@ -211,11 +208,11 @@ def no_sync():
211
208
assert_equal (snapshot ['validated' ], False )
212
209
213
210
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 )
215
212
self .sync_blocks ()
216
213
217
214
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 )
219
216
220
217
completed_idx_state = {
221
218
'basic block filter index' : COMPLETE_IDX ,
@@ -242,12 +239,12 @@ def no_sync():
242
239
self .restart_node (2 , extra_args = [
243
240
'-reindex-chainstate=1' , * self .extra_args [2 ]])
244
241
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 )
246
243
247
244
self .log .info ("Test -reindex of an assumeutxo-synced node" )
248
245
self .restart_node (2 , extra_args = ['-reindex=1' , * self .extra_args [2 ]])
249
246
self .connect_nodes (0 , 2 )
250
- wait_until_helper (lambda : n2 .getblockcount () == FINAL_HEIGHT )
247
+ self . wait_until (lambda : n2 .getblockcount () == FINAL_HEIGHT )
251
248
252
249
253
250
if __name__ == '__main__' :
0 commit comments