1

Can someone please help me understand what just happened, so I and others can account for this in error handling?

I was using web3.py to swap USDC for WMATIC through the UniswapV3 Router on Polygon PoS, using the Infura API to access a node.

Suddenly it stopped working and I got 'replacement transaction underpriced' errors. This thread suggested increasing the gasPrice parameter to at least 10 % larger than the transaction that failed. Didn't work for me. I tried multiple times the old gas price and it still didn't work. It also suggested to manually increase the nonce value. That did make the node accept the transaction, but it never shows up on polygon scan, and get_transaction_count doesn't increment either (I understand Polygonscan isn't perfect).

Finally, I tried using the Alchemy node API instead, which worked with unaltered gas price and nonce. I suspect this means the failed transactions were probably never propagated beyond the Infura node?

When the approve and exactInputSingle transactions went through using the Alchemy node, previously submitted transactions to the Infura node were also mined and showed up on Polygonscan.

An interesting solution was suggested here by user127148: To send a 0 ETH (Matic) transaction to yourself with the same nonce as the stuck transaction to effectively cancel it.

Is this a common problem? Why does it happen? How should you best take this into account for error handling? Will running a local node solve this?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.