Skip to content
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.getTransaction returning null for pending transactions in tx pool #327

Closed
yehjxraymond opened this issue Jul 27, 2021 · 4 comments
Closed

Comments

@yehjxraymond
Copy link

yehjxraymond commented Jul 27, 2021

System information

Geth version: 1.1.0-beta
OS & Version: Ubuntu
Commit hash :6ce2cef4250620d22324f0f74d1c1886487c0536

Expected behaviour

I'm subscribing to the pending transaction via websocket and getting the transaction with the hashes. I'm expecting to get the pending transaction object from the txpool.

Actual behaviour

The get transaction is returning null instead for all the pending transaction hashes.

Steps to reproduce the behavior

  1. Run geth with the following config (using custom ports, so just ignore that):
geth --config /path/to/config.toml --datadir /data/bsc --rpc.allow-unprotected-txs  --syncmode=fast --port 30313 --maxpeers=100 --maxpendpeers=100 --cache=56000 --txpool.globalslots 250000 --txpool.accountslots 128 --txpool.accountqueue 512 --txpool.globalqueue 100000 --txpool.pricelimit 1 --txpool.lifetime 1h0m0s --ws --http.port 8555 --ws.port 8556 --http.api eth,debug,txpool
  1. Get pending tx from a subscription. using ethers.js (using ws provider)
  2. Get transaction (using ipc endpoint) and get null
  3. Verify the same behavior by connecting to IPC directly and also received a null
> eth.getTransaction("0x4e6c7e950b781e96190e9c91d97f5416937035425ba012a3c8a00d3ef7dc69de")
null

Also, getTransaction works for transactions that are mined in a block:

> eth.getTransaction("0xdec78a4f0f56745e5f2d702ede2c598467ab149a290f3dd802b25e5de55cd13b")
{
  blockHash: "0x614eb44c29c89b2efac4dcbe585fb4a27bd2e598bc2be2d26fa0956e75ead9c8",
  blockNumber: 9522390,
  from: "0x2d4c407bbe49438ed859fe965b140dcf1aab71a9",
  gas: 9223372036854776000,
  gasPrice: 0,
  hash: "0xdec78a4f0f56745e5f2d702ede2c598467ab149a290f3dd802b25e5de55cd13b",
  input: "0xf340fa010000000000000000000000002d4c407bbe49438ed859fe965b140dcf1aab71a9",
  nonce: 465227,
  r: "0xd58a8bb7772ffa0aeca971b551947329b8016c248405ad4adcc4ccf469ad86f1",
  s: "0x28aa79170eb2ef08c63396ec8a0ed8c683dd83e0b3e63044bb899ee99642cead",
  to: "0x0000000000000000000000000000000000001000",
  transactionIndex: 484,
  type: "0x0",
  v: "0x93",
  value: 388626748022705939
}

Backtrace

A snapshot of my txpool.status

> txpool.status
{
  pending: 17824,
  queued: 158
}

When submitting logs: please submit them as text and not screenshots.

@unclezoro
Copy link
Collaborator

Thanks for reporting this. Duplicate issue with #341, I will close this one

@unclezoro
Copy link
Collaborator

unclezoro commented Aug 9, 2021

sorry, open again. seems different issue.

@unclezoro unclezoro reopened this Aug 9, 2021
@unclezoro
Copy link
Collaborator

hi, @yehjxraymond Looks like this will happen when the fork happened. As I checked the transcation 0x4e6c7e950b781e96190e9c91d97f5416937035425ba012a3c8a00d3ef7dc69de is not included on the chain.
Let us clarify the procedure.

  1. when will you receive pending tx from a subscription
    Process blocks and the transaction pool reorg, the reorg will trigger emit new transaction event.

  2. what will happen if there is a fork?
    First there are system txs that are auto-generated, please refer to https://docs.binance.org/smart-chain/guides/concepts/system-contract.html. These transactions will also send to the subscription channel, but if query a bit later, you can not find it because the transaction is not on the canonical chain.

@yehjxraymond
Copy link
Author

Hey I realised one the problem is with the app layer which is somehow receiving pending tx from the regular geth node connected to ETH instead. I’ve since resolved the issues. Sorry for the trouble!

Closing this issue now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants