Hey,
My wallet address is 0xDb2b015F7Adf402443d1a2bDf309A28B66b1BE22
, yesterday I made a transaction with a low Gas price
of 0.5 Gwei
and that transaction was stuck and not mined for about an hour,
so to fix that, I created another transaction with the same nonce to drop and replace the old stuck tx, and it worked and the transaction was mined correctly.
Right after that, calling getTransactionCount
(with "pending"
as the block parameter) using the Infura json-rpc API, I keep getting the wrong transaction count for my address (it double counts the replacing transaction and the other transaction), thus using that value for my nonce service creates a nonce gap, making all my future transactions rejected by the network. Also for some reason, Infura keeps counting those failed transactions in the returned value from the RPC call to getTransactionCount
.
This behavior is inconsistent with a local geth
fullnode running on mainnet, to replicate this bug, try the following call on Infura, and on another fullnode
Using Infura’s json-rpc api:
// using the "pending" block parameter
$ curl https://mainnet.infura.io/v3/YOUR-PROJECT-ID -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params": ["0xDb2b015F7Adf402443d1a2bDf309A28B66b1BE22","pending"],"id":1}'
{"jsonrpc":"2.0","id":1,"result":"0x6a"} //0x6a = 106
// Using the "latest" block parameter
$ curl https://mainnet.infura.io/v3/YOUR-PROJECT-ID -X POST -H "Content-Type: application:"eth_getTransactionCount","params": ["0xDb2b015F7Adf402443d1a2bDf309A28B66b1BE22","latest"],"id":1}'
{"jsonrpc":"2.0","id":1,"result":"0x2"}
Using a local geth
fullnode (on mainnet):
> eth.getTransactionCount("0xDb2b015F7Adf402443d1a2bDf309A28B66b1BE22", "pending")
2
> eth.getTransactionCount("0xDb2b015F7Adf402443d1a2bDf309A28B66b1BE22", "latest")
2
It seems that there’s some caching layer on Infura’s side that doesn’t correctly handle drop and replace transactions, and any further transactions with a wrong nonce, any idea if that’s a problem from my side somehow?
Thanks