Skip to content

State sync txns not query-able by block + transaction index combo #369

@0xabhinav

Description

@0xabhinav

System information

Geth version: 0.2.14-tmp-span-hotfix
OS & Version: Ubuntu Server 20.04

Expected behaviour

Block no. + transaction index combo should work similarly with eth_getTransactionByBlockNumberAndIndex as the corresponding tx_hash does with eth_getTransaction

Actual behaviour

eth_getTransactionByBlockNumberAndIndex would return None for State sync txns (per polygonscan) while eth_getTransaction works perfectly and returns transactions details

Steps to reproduce the behaviour

Using a self-hosted archival node's rpc, but is reproducible with my_node_url = 'https://polygon-rpc.com/' too

In [18]: from web3 import Web3, HTTPProvider

In [19]: w3 = Web3(HTTPProvider(my_node_url))

In [20]: by_hash = w3.eth.getTransaction('0x5053e6008f1ac02397f9dfb5e2a2e6db5187765fbbf730f4cfc22fca1866139d')

In [22]: by_hash.blockNumber
Out[22]: 26809088

In [23]: by_hash.transactionIndex
Out[23]: 154

In [24]: by_index = w3.eth.get_transaction_by_block(by_hash.blockNumber, by_hash.transactionIndex)
---------------------------------------------------------------------------
TransactionNotFound                       Traceback (most recent call last)
<ipython-input-24-011f9a77334a> in <module>
----> 1 by_index = w3.eth.get_transaction_by_block(by_hash.blockNumber, by_hash.transactionIndex)
...
/usr/local/lib/python3.8/dist-packages/web3/_utils/method_formatters.py in raise_transaction_not_found_with_index(params)
    608     block_identifier = params[0]
    609     transaction_index = to_integer_if_hex(params[1])
--> 610     raise TransactionNotFound(
    611         f"Transaction index: {transaction_index} "
    612         f"on block id: {block_identifier} not found."

TransactionNotFound: Transaction index: 154 on block id: 0x1991300 not found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions