Hi,
I’m subsribing to ‘newPendingTransactions’ and I’m getting a bunch of them, so that’s fine. The problem comes when I try to get the info of each transaction using w3.eth.getTransaction(tx). Some of them work fine and return the info, while others (many, about half of them) throw the Exception:
web3.exceptions.TransactionNotFound: Transaction with hash: 0x74335b11… not found
If I look for those transactions in etherscan.io, it shows that they indeed exist and are pending. What is going on here? Why can’t I fetch the data of these transactions?
This is my function:
msg = {"id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]}
async def pending_tx():
async with websockets.connect(API) as ws:
await ws.send(json.dumps(msg))
while ws.open:
response = json.loads(await ws.recv())
try:
print(w3.eth.getTransaction(response['params']['result']))
except Exception as e:
print(tb.print_exc())
Another question I have regarding the subscription to pending tx: Does it indeed show every pending transaction sent to the miners? If not, what type of transactions is not showing, or why wouldn’t it show certain tx?
Thanks!