i'm writing in go-lang and using go-ethereum package to interact with nodes. For testing purposes go-ethereum provides blockhchain simulation via SimulatedBackend (https://github.com/ethereum/go-ethereum/blob/master/accounts/abi/bind/backends/simulated.go) that a lot of forums recommend to use. So i built a local node that use the SimulatedBackend to simulate blockchain interactions and it works perfectly, however i have a problem to test transaction replacement (cancellation, acceleration) because the sendTransaction
method on the simulated blockchain inserts the transaction to a pending block and not to mempool thus i can't send a replacement transaction with same nonce from the client because the first transaction already included in pending block. Couldn't find any simulated/mocked mempool in go-ethereum package. My question is should i implement the mempool by myself or there is some work around?
SendTransactionReplacement()
function , which is going to be a copy ofSendTransaction()
but with your transaction replaced (remove the old and add the new) in the pending block.sendTransaction
method only. But maybe as you suggested in my mocked node i can check if transaction with same nonce is in pending block i can switch them if fee is higher