diff --git a/packages/client/lib/sync/fetcher/blockfetcher.ts b/packages/client/lib/sync/fetcher/blockfetcher.ts index e0f2325b73a..8f58ee87a88 100644 --- a/packages/client/lib/sync/fetcher/blockfetcher.ts +++ b/packages/client/lib/sync/fetcher/blockfetcher.ts @@ -30,6 +30,10 @@ export class BlockFetcher extends BlockFetcherBase { max: count, }) )[1] + if (!headers) { + this.config.logger.error(`peer ${peer?.id} returned no headers for block ${first}`) + return [] + } const bodies = (await peer!.eth!.getBlockBodies({ hashes: headers.map((h) => h.hash()) }))[1] const blocks: Block[] = bodies.map(([txsData, unclesData]: BlockBodyBuffer, i: number) => { const opts = {