@@ -94,8 +94,16 @@ async def _load_and_process_headers(self) -> None:
94
94
# TODO implement the maximum task size at each step instead of this magic number
95
95
max_headers = min ((MAX_BODIES_FETCH , MAX_RECEIPTS_FETCH )) * 4
96
96
batch_id , headers = await self .header_queue .get (max_headers )
97
- await self ._process_headers (headers )
98
- self .header_queue .complete (batch_id , headers )
97
+ try :
98
+ await self ._process_headers (headers )
99
+ except NoEligiblePeers :
100
+ self .logger .info (
101
+ f"No available peers to sync with, retrying in { self .NO_PEER_RETRY_PAUSE } s"
102
+ )
103
+ self .header_queue .complete (batch_id , tuple ())
104
+ await self .sleep (self .NO_PEER_RETRY_PAUSE )
105
+ else :
106
+ self .header_queue .complete (batch_id , headers )
99
107
100
108
async def _calculate_td (self , headers : Tuple [BlockHeader , ...]) -> int :
101
109
"""Return the score (total difficulty) of the last header in the given list.
@@ -297,6 +305,9 @@ async def _download_receipts(self,
297
305
receipt_bundles = tuple (concat (all_receipt_bundles ))
298
306
headers = tuple (concat (all_missing_headers ))
299
307
308
+ if len (receipt_bundles ) == 0 :
309
+ continue
310
+
300
311
# process all of the returned receipts, storing their trie data
301
312
# dicts in the database
302
313
receipts , trie_roots_and_data_dicts = zip (* receipt_bundles )
0 commit comments