ethers.js
ethers.js copied to clipboard
already known error from geth, ethers should have a mechanism to recover nicely from it
Describe the bug
There are some scenario where you want to use the "latest" nonce as oposed to "pending". this is for example the case when you want to revover from a previous command that perfrom a specific action on the blockchain and do not have access to the tx hash anymore, or you are not sure it correspond exactly to the action
The issue arise when the user re-execute the command, it will perform the exact same tx and so will have the same hash unless gasprice changes, etc...
Now, node like geth report an error when a tx is submitted that already exist in the pool, see :https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/tx_pool.go#L58
ethers. sendTransaction throw when that happen and while it is possible to catch such error, there is no data about the tx. not even a tx hash.
It would be great if ethers could catch these error and consider the tx submitted and return a TransactionResponse as usual so tx.wait
continue like the tx was just submitted.
Reproduction steps send one tx with very low gas on rinkeby execute it again
Search Terms "already known" brings this issue : https://github.com/ethers-io/ethers.js/issues/1183