Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix waitingforreceipt error #7098

Merged
merged 8 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/web3-eth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
## [Unreleased]

### Fixed

- Fixed geth issue when running a new instance, transactions will index when there are no blocks created (#7098)
21 changes: 16 additions & 5 deletions packages/web3-eth/src/rpc_method_wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,22 @@
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;

Check warning on line 510 in packages/web3-eth/src/rpc_method_wrappers.ts

View check run for this annotation

Codecov / codecov/patch

packages/web3-eth/src/rpc_method_wrappers.ts#L507-L510

Added lines #L507 - L510 were not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also should be tested locally with Geth before merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup tested locally and works well

}

}

return isNullish(response)
? response
: (format(
Expand Down
Loading