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

Detect when a transaction has not been propagated to the mem pool. #3

Open
fleupold opened this issue Mar 19, 2021 · 3 comments
Open

Comments

@fleupold
Copy link
Contributor

For GPv2 we today tried to submit a solution, which apparently was sent to a "bad node" and not propagated to the mem-pool.

The retry logic kept waiting for confirmation until the timeout was reached. However, it would be nice if it could detect that the tx is not part of the mempool. @denisgranha suggested two approaches:

  1. Use eth_getTransactionCount in the pending block and see if it matches your count of txs.
  2. Use eth_getTransactionByHash in the pending block and see that it returns something

I'm not sure if this logic should live here or rather in ethcontract-rs, but likely not in GPv2 (as it seems generic enough to be useful to other projects).

Here are the logs showing the timeout and here is the tx that was successfully mined just after the timeout:

https://etherscan.io/tx/0xbb06ba8efc94911562387cf40a376bb9339c203a2b1015683034c3cffc0d3a4d

image

@fleupold
Copy link
Contributor Author

fleupold commented Apr 7, 2021

@vkgnosis
Copy link
Contributor

vkgnosis commented Apr 7, 2021

I am not sure if the pending block works this way. Googling around I find some sources saying that it is only relevant if the node is mining. https://ethereum.stackexchange.com/questions/11298/web3-eth-getblockpending-returns-latest-block-not-pending-block-is-that-ex openethereum/parity-ethereum#5014 . Either way the documentation doesn't specify what pending block means.
We should be able to detect if the node doesn't know about a transaction with eth_gettransactoinbyhash call. If we see this isn't the case we can resubmit. Or we can always resubmit in intervals and detect and ignore "gas price hasn't increased enough" errors. We'll need that anyway because a resubmit could go to a different load balanced node which does know about the transaction.

@fleupold
Copy link
Contributor Author

fleupold commented Apr 7, 2021

I have empirically used pending block and was able to see transactions that are shown as pending on etherscan but not yet mined. We can maybe ask the OE team what it specifically means in their context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants