From f611b21de46c5d78d0428551a4c09271564eee31 Mon Sep 17 00:00:00 2001 From: Khaidar Kairbek <149614838+khaidarkairbek@users.noreply.github.com> Date: Thu, 9 Jan 2025 01:09:24 +0500 Subject: [PATCH] fix: removing unnecessary _eth_getBlockReceipts requests (#1418) --- packages/core/src/sync-historical/index.ts | 4 ++++ packages/core/src/sync-realtime/index.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/core/src/sync-historical/index.ts b/packages/core/src/sync-historical/index.ts index 2e0e96c6f..9e4ac29a1 100644 --- a/packages/core/src/sync-historical/index.ts +++ b/packages/core/src/sync-historical/index.ts @@ -346,6 +346,10 @@ export const createHistoricalSync = async ( block: Hash, transactionHashes: Set, ): Promise => { + if (transactionHashes.size === 0) { + return []; + } + if (isBlockReceipts === false) { const transactionReceipts = await Promise.all( Array.from(transactionHashes).map((hash) => diff --git a/packages/core/src/sync-realtime/index.ts b/packages/core/src/sync-realtime/index.ts index f92c8e302..2bed20600 100644 --- a/packages/core/src/sync-realtime/index.ts +++ b/packages/core/src/sync-realtime/index.ts @@ -581,6 +581,10 @@ export const createRealtimeSync = ( blockHash: Hash, transactionHashes: Set, ): Promise => { + if (transactionHashes.size === 0) { + return []; + } + if (isBlockReceipts === false) { const transactionReceipts = await Promise.all( Array.from(transactionHashes).map(async (hash) =>