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

No TX Index without ReceiptsManager #3926

Open
ScottyPoi opened this issue Mar 20, 2025 · 0 comments
Open

No TX Index without ReceiptsManager #3926

ScottyPoi opened this issue Mar 20, 2025 · 0 comments

Comments

@ScottyPoi
Copy link
Contributor

Context:

When --saveReceipts is set, the client maintains in its DB a "transaction index". The "transaction index" is a key/value mapping of txHash > [blockHash, txIndex].

To find a transaction by hash, we look up the txHash to retrieve the blockHash and index (index here meaning which tx in the block.transactions array). We then use the blockHash to retrieve the block, and find the transaction at the right index in that block.

Problem:

This is only possible via the ReceiptsManager, which only exists if --saveReceipts is on. Transactions are not indexed otherwise. This does not feel like a necessary coupling. Additionally, in the process of looking up a transaction by hash (via eth_getTransactionByHash), we currently also do an unnecessary retrieval of the receipt from the DB.

Solution:

If we were to maintain the TxIndex independently of Receipts, we could enable Tx lookup by hash without also needing to have --saveReceipts on.

  • At a very minimum we should refactor getTransactionByHash to avoid the extra DB lookup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant