diff --git a/packages/web3-eth/CHANGELOG.md b/packages/web3-eth/CHANGELOG.md index 2b6c0e08005..ba620044bde 100644 --- a/packages/web3-eth/CHANGELOG.md +++ b/packages/web3-eth/CHANGELOG.md @@ -256,4 +256,8 @@ Documentation: - WebEth has `setTransactionMiddleware` and `getTransactionMiddleware` for automatically passing to `sentTransaction` (#7088) - `TransactionMiddleware` and `TransactionMiddleware` data types are exported (#7088) -## [Unreleased] \ No newline at end of file +## [Unreleased] + +### Fixed + +- Fixed geth issue when running a new instance, transactions will index when there are no blocks created (#7098) \ No newline at end of file diff --git a/packages/web3-eth/src/rpc_method_wrappers.ts b/packages/web3-eth/src/rpc_method_wrappers.ts index 336aef3a23d..3a03afe0967 100644 --- a/packages/web3-eth/src/rpc_method_wrappers.ts +++ b/packages/web3-eth/src/rpc_method_wrappers.ts @@ -496,11 +496,22 @@ export async function getTransactionReceipt( transactionHash, DEFAULT_RETURN_FORMAT, ); - const response = await ethRpcMethods.getTransactionReceipt( - web3Context.requestManager, - transactionHashFormatted, - ); - + let response; + try { + response = await ethRpcMethods.getTransactionReceipt( + web3Context.requestManager, + transactionHashFormatted, + ); + } catch (error) { + // geth indexing error, we poll until transactions stopped indexing + if (typeof error === 'object' && !isNullish(error) && 'message' in error && (error as { message: string }).message === 'transaction indexing is in progress') { + console.warn('Transaction indexing is in progress.') + } else { + throw error; + } + + } + return isNullish(response) ? response : (format(