Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

When retrieving transactions by hash, check the pending transactions first #1542

Merged
merged 2 commits into from
Jun 10, 2019

Conversation

ajsutton
Copy link
Contributor

PR description

Previously it was possible for a transaction to be "missed" by calls to eth_getTransactionByHash if the transaction was added to a block between when we checked the blockchain and when we checked the pending transaction pool.

Since transactions are added to the blockchain before being removed from the pending transactions, we are guaranteed to find the transaction if we check the pending transaction pool first because if it's not there it would already be in the blockchain and thus be returned when we request it.

This also has the advantage of performing the in-memory lookup first and only then falling back to the disk-based lookup if required.

…first.

Previously it was possible for a transaction to be "missed" by this call if it was added to a block between when we checked the blockchain and when we checked the pending transaction pool.
@ajsutton ajsutton requested a review from rojotek June 10, 2019 05:09
Copy link
Member

@rojotek rojotek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@ajsutton ajsutton merged commit a7bb9eb into PegaSysEng:master Jun 10, 2019
@ajsutton ajsutton deleted the get-transaction-pending-first branch June 10, 2019 05:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants