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(snapshot): block increment for Transactions segment #6274

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions crates/snapshot/src/segments/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ impl<DB: Database> Segment<DB> for Transactions {
let mut snapshot_writer =
snapshot_provider.get_writer(*block_range.start(), SnapshotSegment::Transactions)?;

for block in block_range {
let mut blocks = block_range.peekable();
while let Some(block) = blocks.next() {
let block_body_indices = provider
.block_body_indices(block)?
.ok_or(ProviderError::BlockBodyIndicesNotFound(block))?;
Expand All @@ -48,7 +49,12 @@ impl<DB: Database> Segment<DB> for Transactions {

snapshot_writer.append_transaction(tx_number, transaction)?;
}
snapshot_writer.increment_block(SnapshotSegment::Transactions)?;

if blocks.peek().is_some() {
let _snapshot_block =
snapshot_writer.increment_block(SnapshotSegment::Transactions)?;
debug_assert_eq!(_snapshot_block, block);
}
}

Ok(())
Expand Down
Loading