Currently, GetTransactionCount uses StateAndHeaderByNumber to get the nonce from the pending state. But, only the miner knows the pending state so if the local node is not a miner, then the state used to get the nonce will not include any pending transactions that the sender has submitted.
It seems that GetTransactionCount should ask the local node's transaction pool for the nonce if we want the pending nonce to include pending transactions.
Currently, GetTransactionCount uses StateAndHeaderByNumber to get the nonce from the pending state. But, only the miner knows the pending state so if the local node is not a miner, then the state used to get the nonce will not include any pending transactions that the sender has submitted.
It seems that GetTransactionCount should ask the local node's transaction pool for the nonce if we want the pending nonce to include pending transactions.
Mirror: https://github.com/ethereum/go-ethereum/pull/15794