Skip to content

Commit

Permalink
Update packages/client/lib/sync/fetcher/blockfetcher.ts
Browse files Browse the repository at this point in the history
log error if no headers are returned

Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
  • Loading branch information
ryanio and acolytec3 authored Jul 8, 2021
1 parent 2ef2481 commit 7b8145c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/client/lib/sync/fetcher/blockfetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export class BlockFetcher extends BlockFetcherBase<Block[], Block> {
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 = {
Expand Down

0 comments on commit 7b8145c

Please sign in to comment.