erigontech / erigontech/erigon
rpc: eth_sendRawTransactionSync fast path never returns an already available receipt
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 1.5k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 465
Description
`eth_sendRawTransactionSync` (`rpc/jsonrpc/send_transaction.go:114`, `main` at 52b071b5d8) checks the receipt before waiting on the receipts subscription:
```go
if receipt, err := api.GetTransactionReceipt(ctx, hash); err != nil && receipt != nil {
return receipt, nil
}
```
`GetTransactionReceipt` never returns a receipt together with an error, so this branch never runs. A transaction that is mined before the receipts filter attaches waits for the full timeout, although `eth_getTransactionReceipt` already returns it.
Fix: `err == nil && receipt != nil`, plus a test for a transaction that is already mined when the call starts. Found in the review of #23969.
Contributor guide
Research direction
Start in rpc/jsonrpc/send_transaction.go at the eth_sendRawTransactionSync entry point around line 114, and inspect the existing receipt lookup and subscription wait. Add a test for a transaction already mined when the call starts. Done means the fast path returns the available receipt without waiting for the full timeout, and the test passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, blockchain
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100