-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: add block_body_indices for BlockchainProvider2 #10106
Conversation
self.database.block_body_indices(number) | ||
if let Some(indices) = self.database.block_body_indices(number)? { | ||
Ok(Some(indices)) | ||
} else if self.canonical_in_memory_state.hash_by_number(number).is_some() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should also use the BlockState
and traverse its parent blocks for this and the anchor block number to read the indices from disk
ae7bb25
to
d04050b
Compare
let mut parent_chain = state.parent_state_chain(); | ||
parent_chain.reverse(); | ||
let anchor_num = state.anchor().number; | ||
let mut stored_indices = self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading this correctly, then we need to do a + 1 here on the first_tx_num
reth/crates/stages/stages/src/stages/bodies.rs
Lines 127 to 128 in 48d4c79
// Get id for the next tx_num of zero if there are no transactions. | |
let mut next_tx_num = tx_block_cursor.last()?.map(|(id, _)| id + 1).unwrap_or_default(); |
I would like some review on the correctness of this method, specifically whether or not
next_tx
is accurate. Previously this would just go to the database, when it should be possible to fetch block body indices for the in memory canonical state.