Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

eth_getTransactionReceipt throws an error when transaction is not found #10550

Closed
charles-cooper opened this issue Mar 29, 2019 · 6 comments
Closed
Labels
M6-rpcapi 📣 RPC API. Z1-question 🙋‍♀️ Issue is a question. Closer should answer.
Milestone

Comments

@charles-cooper
Copy link

  • Parity Ethereum version: 2.3.8-stable
  • Operating system: Linux
  • Installation: github release
  • Fully synchronized: yes
  • Network: ethereum / kovan
  • Restarted: yes

When querying eth_getTransactionReceipt for an unmined transaction, I would expect to get either a receipt or null as specified in https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt. Instead, I get an error message like

Transaction with hash: <hash> not found.
@jam10o-new
Copy link
Contributor

Was this transaction one that your node originally broadcast?

@charles-cooper
Copy link
Author

charles-cooper commented Mar 29, 2019

Was this transaction one that your node originally broadcast?

Yes

@jam10o-new jam10o-new added F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M6-rpcapi 📣 RPC API. labels Apr 1, 2019
@jam10o-new jam10o-new added this to the 2.5 milestone Apr 1, 2019
@jam10o-new
Copy link
Contributor

Can you please share the exact messages you're seeing (omitting private information if you wish)? I'm having trouble finding where that error might be emitted from.

@charles-cooper
Copy link
Author

charles-cooper commented Apr 2, 2019

@joshua-mir, sorry, I mixed up two error messages I was seeing. The Transaction with hash..not found is generated by my web3 client (as a result of the RPC call returning null). Here's the other error message I see,

{"code": -32000, "message": "Block information is incomplete while
ancient block sync is still in progress, before it's finished we can't determine the existence of requested item."}

Both happen in the same conditions (the node broadcast the transaction but the tx is still unmined), the only difference seems to be whether ancient block sync has finished or not. In the second case, I would expect the node to return null or the transaction. In both cases, I would expect the node to be able to find a transaction it broadcast, but I guess the recently merged JSON-RPC spec EIP has a note which says that the receipt is not available for pending transactions. It's unclear to me whether this is a requirement or an ambiguity for the client developer, but I feel like parity used to return the transaction with blockHash set to null. Will parity be returning null for pending transactions going forward then?
EDIT: Also, I'm not sure I'm consistently getting null vs transaction-with-null-blockhash for unmined transactions.

@jam10o-new jam10o-new added Z1-question 🙋‍♀️ Issue is a question. Closer should answer. and removed F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. labels Apr 2, 2019
@jam10o-new
Copy link
Contributor

If you are running a miner or authority, your node will be maintaining a pending block, which is what queries to the pending block reference - that's currently how that ambiguity plays out in parity, but if we decide to implement that rpc spec EIP I'd imagine the ambiguity should be removed. You certainly shouldn't rely on having access to the pending block as a user or developer though.

The reason you are seeing the ancient block sync reference when looking for a transaction that should be in the pending block is simply because we don't know whether it's a replay of an old transaction in a block we aren't aware of intil ancient sync is complete.

@d10r
Copy link

d10r commented Oct 17, 2019

I'm seeing the same issue with a Parity node (2.5.5) NOT running as miner/authority.
Looks like this can happen as long as ancient blocks were not fully synced.
If Parity is running with --no-ancient-blocks, the error message changes - see web3/web3.js#1423 (comment) -, but it leads to the same issues when using web3.js.

Please give advice if web3.js should be modified to keep polling when eth_getTransactionReceipt returns an error / that specific error or if it's something which should be changed on Parity side.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
M6-rpcapi 📣 RPC API. Z1-question 🙋‍♀️ Issue is a question. Closer should answer.
Projects
None yet
Development

No branches or pull requests

3 participants