-
Notifications
You must be signed in to change notification settings - Fork 20.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eth_getTransactionCount does not include pending transactions when 'pending' qualifier given for a deployed contract #19103
Comments
This is an interesting corner case (ping @fjl @holiman). A while ago we changes the pending nonce API to return the nonce from the txpool, not from the pending state. The reason is that the pending state just contains a few txs (that fit in the next block) vs. the txpool contains all the txs. However, the txpool obviously cannot figure out the nonce of a contract, since it doesn't execute code. The issue with your use case is that the only way to accurately return the pending nonce of a contract is to execute all the transactions. With thousands of txs queued up, that's not feasible. I think the practical answer is that you should try to not depend on pending contract state, as it's unreliable. |
I agree. |
@angelosuinan yes |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Unfortunately we cannot fix this issue. Retrieving pending contract state is not meaningfully possible, since it would entail executing all the transactions in the pool (20 blocks' worth). |
Hi!
Similar issue with #2880 but in this issue I want to get the transaction count of a deployed contract.
eth_getTransactionCount does not include pending transactions when 'pending' qualifier is given for a deployed contract
web3.eth.getTransactionCount(myDeployedContract, "pending");
For example my contract, named as
ContractCreator
, has a createContract function that when executed will deploy another contract. In order to determine what is the address that been deployed by theContractCreator
. I will use ethereumjs-util generateAddress functionethereumjs-util.generateAddress(ContractCreatorAddress, transactionCount)
System information
Geth and OS version:
Geth/v1.8.22-omnibus-260f7fbd/linux-amd64/go1.11.1
using a public node ropsten.infura.ioExpected behaviour
Return the transactionCount including pending transaction
Actual behaviour
The text was updated successfully, but these errors were encountered: