diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index 849b8b54f0..b6dab037b0 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- When there is no log data for fullBlock, it is determined as lightBlock. (#350) + ## [5.1.6] - 2024-10-23 ### Changed - Bump `@subql/common` dependency diff --git a/packages/node/src/ethereum/api.ethereum.test.ts b/packages/node/src/ethereum/api.ethereum.test.ts index 31ace2099a..5e2d1c5306 100644 --- a/packages/node/src/ethereum/api.ethereum.test.ts +++ b/packages/node/src/ethereum/api.ethereum.test.ts @@ -367,6 +367,10 @@ describe('Api.ethereum', () => { expect(isFullBlock(blockData)).toBeTruthy(); expect(isFullBlock(lightBlock)).toBeFalsy(); + // block with transactions, but no logs 4913287 + const noLogBlockData = (await (ethApi as any).fetchBlock(4913287)).block; + expect(isFullBlock(noLogBlockData)).toBeTruthy(); + // block without transaction const block10001 = (await (ethApi as any).fetchBlock(10001)).block; const lightBlock10001 = (await (ethApi as any).fetchLightBlock(10001)) diff --git a/packages/node/src/ethereum/block.ethereum.ts b/packages/node/src/ethereum/block.ethereum.ts index 5ba9d687b3..329b895df9 100644 --- a/packages/node/src/ethereum/block.ethereum.ts +++ b/packages/node/src/ethereum/block.ethereum.ts @@ -120,7 +120,7 @@ export function isFullBlock(block: BlockContent): block is EthereumBlock { // Light etherum block just contains transaction hashes for transactions. // If the block has no transactions then both types would be the same - if (block.transactions.length && block.logs.length) { + if (block.transactions.length) { return typeof (block as EthereumBlock).transactions[0] !== 'string'; } return false;