@@ -158,7 +158,7 @@ async def _fetch_full_skeleton(self) -> None:
158
158
pairs = tuple (zip (parents , children ))
159
159
try :
160
160
validate_pair_coros = [
161
- self ._chain .coro_validate_chain (parent , (child , ))
161
+ self .wait ( self . _chain .coro_validate_chain (parent , (child , ) ))
162
162
for parent , child in pairs
163
163
]
164
164
await asyncio .gather (* validate_pair_coros , loop = self .get_event_loop ())
@@ -208,7 +208,11 @@ async def _get_final_headers(self, peer: TChainPeer, previous_tail_header: Block
208
208
if len (final_headers ) == 0 :
209
209
break
210
210
211
- await self ._chain .coro_validate_chain (previous_tail_header , final_headers )
211
+ await self .wait (self ._chain .coro_validate_chain (
212
+ previous_tail_header ,
213
+ final_headers ,
214
+ SEAL_CHECK_RANDOM_SAMPLE_RATE ,
215
+ ))
212
216
await self .wait (self ._fetched_headers .put (final_headers ))
213
217
previous_tail_header = final_headers [- 1 ]
214
218
@@ -292,7 +296,11 @@ async def _find_launch_headers(self, peer: TChainPeer) -> Tuple[BlockHeader, ...
292
296
) from exc
293
297
294
298
# validate new headers against the parent in the database
295
- await self .wait (self ._chain .coro_validate_chain (launch_parent , new_headers ))
299
+ await self .wait (self ._chain .coro_validate_chain (
300
+ launch_parent ,
301
+ new_headers ,
302
+ SEAL_CHECK_RANDOM_SAMPLE_RATE ,
303
+ ))
296
304
return new_headers
297
305
298
306
async def _fill_in_gap (
@@ -344,7 +352,11 @@ async def _fill_in_gap(
344
352
# validate the filled headers
345
353
filled_gap_children = tuple (concatv (gap_headers , pairs [gap_index + 1 ]))
346
354
try :
347
- await self ._chain .coro_validate_chain (gap_parent , filled_gap_children )
355
+ await self .wait (self ._chain .coro_validate_chain (
356
+ gap_parent ,
357
+ filled_gap_children ,
358
+ SEAL_CHECK_RANDOM_SAMPLE_RATE ,
359
+ ))
348
360
except ValidationError :
349
361
self .logger .warning (
350
362
"%s returned an invalid gap for index %s, with pairs %s, filler %s" ,
@@ -651,11 +663,11 @@ async def _fetch_segment(
651
663
return tuple ()
652
664
else :
653
665
try :
654
- await self ._chain .coro_validate_chain (
666
+ await self .wait ( self . _chain .coro_validate_chain (
655
667
parent_header ,
656
668
headers ,
657
669
SEAL_CHECK_RANDOM_SAMPLE_RATE ,
658
- )
670
+ ))
659
671
except ValidationError as e :
660
672
self .logger .warning ("Received invalid headers from %s, disconnecting: %s" , peer , e )
661
673
await peer .disconnect (DisconnectReason .subprotocol_error )
@@ -821,7 +833,11 @@ async def _full_skeleton_sync(self, skeleton_syncer: SkeletonSyncer[TChainPeer])
821
833
raise ValidationError (f"Header skeleton gap of { gap_length } > { MAX_HEADERS_FETCH } " )
822
834
elif gap_length == 0 :
823
835
# no need to fill in when there is no gap, just verify against previous header
824
- await self ._chain .coro_validate_chain (previous_segment [- 1 ], segment )
836
+ await self .wait (self ._chain .coro_validate_chain (
837
+ previous_segment [- 1 ],
838
+ segment ,
839
+ SEAL_CHECK_RANDOM_SAMPLE_RATE ,
840
+ ))
825
841
elif gap_length < 0 :
826
842
raise ValidationError (
827
843
f"Invalid headers: { gap_length } gap from { previous_segment } to { segment } "
0 commit comments