From 4b0d7f6bef3f45c88f87ae6dae0e10b23bd113d6 Mon Sep 17 00:00:00 2001 From: Khaidar Kairbek Date: Wed, 8 Jan 2025 18:16:10 +0500 Subject: [PATCH] fix: removing unnecessary _eth_getBlockReceipts requests --- 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) =>