Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 4c36f55

Browse files
author
Alex
authored
fix waitingforreceipt error (#7098)
* fix waitingforreceipt error * update cach * remove comment * throw other errors * update changelog and text * update linter
1 parent 8b11192 commit 4c36f55

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

packages/web3-eth/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,8 @@ Documentation:
256256
- WebEth has `setTransactionMiddleware` and `getTransactionMiddleware` for automatically passing to `sentTransaction` (#7088)
257257
- `TransactionMiddleware` and `TransactionMiddleware` data types are exported (#7088)
258258

259-
## [Unreleased]
259+
## [Unreleased]
260+
261+
### Fixed
262+
263+
- Fixed geth issue when running a new instance, transactions will index when there are no blocks created (#7098)

packages/web3-eth/src/rpc_method_wrappers.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,22 @@ export async function getTransactionReceipt<ReturnFormat extends DataFormat>(
496496
transactionHash,
497497
DEFAULT_RETURN_FORMAT,
498498
);
499-
const response = await ethRpcMethods.getTransactionReceipt(
500-
web3Context.requestManager,
501-
transactionHashFormatted,
502-
);
503-
499+
let response;
500+
try {
501+
response = await ethRpcMethods.getTransactionReceipt(
502+
web3Context.requestManager,
503+
transactionHashFormatted,
504+
);
505+
} catch (error) {
506+
// geth indexing error, we poll until transactions stopped indexing
507+
if (typeof error === 'object' && !isNullish(error) && 'message' in error && (error as { message: string }).message === 'transaction indexing is in progress') {
508+
console.warn('Transaction indexing is in progress.')
509+
} else {
510+
throw error;
511+
}
512+
513+
}
514+
504515
return isNullish(response)
505516
? response
506517
: (format(

0 commit comments

Comments
 (0)