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(provider): fix subtract overflow on block_state_by_tx_id #10467

Merged
merged 2 commits into from
Aug 23, 2024

Conversation

joshieDo
Copy link
Collaborator

It fixes it, but I'm unsure on what good is a Ok(Some(None,txindex))

@joshieDo joshieDo added the C-bug An unexpected or incorrect behavior label Aug 22, 2024
@@ -165,7 +165,7 @@ where
let Some(body_index) = provider.block_body_indices(block_number)? else {
return Ok(None)
};
let tx_index = id - body_index.last_tx_num();
let tx_index = body_index.last_tx_num() - id;
Ok(Some((None, tx_index as usize)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

unsure on what good is a Ok(Some(None,txindex))

no good, let's do

Suggested change
Ok(Some((None, tx_index as usize)))
Ok(Some(None))

and return Some((block_state, tx_index)) below

@shekhirin shekhirin added A-db Related to the database A-blockchain-tree Related to sidechains, reorgs and pending blocks labels Aug 23, 2024
@joshieDo joshieDo added this pull request to the merge queue Aug 23, 2024
Merged via the queue into main with commit 23f9f4a Aug 23, 2024
34 checks passed
@joshieDo joshieDo deleted the joshie/txindex branch August 23, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-tree Related to sidechains, reorgs and pending blocks A-db Related to the database C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants