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

Fix missing tx index on reorg #8027

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

asdacap
Copy link
Contributor

@asdacap asdacap commented Jan 8, 2025

Fix #6560

  • The tx index is removed on second block after reorg to another second block but the canonical tx is in the first block when going to the second block branch.

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

  • Reproducable with unit tests.

Comment on lines 382 to 388
byte[] txIndexData = _transactionDb.Get(tx.Hash);
if (txIndexData is not null && txIndexData.Length != Hash256.Size)
{
long blockNumber = new RlpStream(txIndexData).DecodeLong();
if (blockNumber != block.Number) continue;
}

Copy link
Member

Choose a reason for hiding this comment

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

Maybe simpler fix would be never remove block transactions and allow for it pointing to a block where it doesn't exist, and then handle that on searching for receipt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, I guess that works too

Copy link
Member

Choose a reason for hiding this comment

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

You are still removing it though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Method also use to remove old tx index (the tx lookup limit config). So its no longer called during reorg.

Copy link
Member

Choose a reason for hiding this comment

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

Ah you are right, I was confused about method being still there, but it is for pruning.

Can you confirm it doesn't break eth_getLogs and eth_getTransactionReceipt ?

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

Successfully merging this pull request may close these issues.

eth_getTransactionReceipt missing receipts - fix verification
2 participants