When executing a smart contract through one owner account, and if one transaction gets stuck( due to low gas price), all the other transactions submitted after that becomes pending. Is there any well-known solution to this problem. My code looks like following,
myContract.methods.myMethod(fromWallet, toWallet, amount, companyName).send(txParams)
.on('transactionHash', function (hash) {
console.log("transaction submited " + hash);
})
.on('receipt', receipt => {
//do something when get the reciept
})
.on('error', error => {
console.log('error', error);
})
As my understanding receipt
event happens only after the transaction is mined by miners. Is there any way that I can wait for sometime and if transaction still pending, cancel/resubmit to avoid the queue of transactions blocking my application. Appreciate any help.