I wish you send nonce with every transaction so that I can store my nonce in DB and can override a specific transaction if it is pending for a while.
I know I can use eth.getTransactionCount("accountAddress");
to get the number of transactions sent from a specific address and this will be the nonce.
But, the transactionCount only returns the count of mined transactions and not exactly sent transactions.
For e.g., if I send a transaction with nonce 18, and it's not mined yet. And I try to send next transaction from the same account and I calculate transaction count for this address, the transaction count returns 18 (but I should send transaction with nonce 19, right?). So the question is simple:
How can I calculate the nonce for my next transaction keeping the case in mind where there may be pending transactions from the same address?