@@ -662,13 +662,7 @@ async def _fetch_segment(
662
662
return tuple ()
663
663
else :
664
664
# stitch headers together in order, ignoring duplicates
665
- try :
666
- self ._stitcher .register_tasks (headers )
667
- except DuplicateTasks as exc :
668
- non_duplicate_headers = tuple (h for h in headers if h not in exc .duplicates )
669
- if len (non_duplicate_headers ):
670
- self ._stitcher .register_tasks (non_duplicate_headers )
671
-
665
+ self ._stitcher .register_tasks (headers , ignore_duplicates = True )
672
666
return headers
673
667
674
668
async def _request_headers (
@@ -816,21 +810,11 @@ async def _full_skeleton_sync(self, skeleton_syncer: SkeletonSyncer[TChainPeer])
816
810
# the first header of this segment was already registered: no problem, carry on
817
811
pass
818
812
819
- try :
820
- self ._stitcher .register_tasks (first_segment )
821
- except DuplicateTasks as exc :
822
- non_duplicate_headers = tuple (h for h in first_segment if h not in exc .duplicates )
823
- if len (non_duplicate_headers ):
824
- self ._stitcher .register_tasks (non_duplicate_headers )
813
+ self ._stitcher .register_tasks (first_segment , ignore_duplicates = True )
825
814
826
815
previous_segment = first_segment
827
816
async for segment in self .wait_iter (skeleton_generator ):
828
- try :
829
- self ._stitcher .register_tasks (segment )
830
- except DuplicateTasks as exc :
831
- non_duplicate_headers = tuple (h for h in segment if h not in exc .duplicates )
832
- if len (non_duplicate_headers ):
833
- self ._stitcher .register_tasks (non_duplicate_headers )
817
+ self ._stitcher .register_tasks (segment , ignore_duplicates = True )
834
818
835
819
gap_length = segment [0 ].block_number - previous_segment [- 1 ].block_number - 1
836
820
if gap_length > MAX_HEADERS_FETCH :
0 commit comments