chore: use each prune segment method on remove_blocks_above (#9568)

This commit is contained in:
joshieDo
2024-07-17 18:41:22 +02:00
committed by GitHub
parent bc4a16737b
commit 38bc7a14a3
2 changed files with 6 additions and 12 deletions

View File

@ -185,17 +185,11 @@ where
let mut receipts_writer = sf_provider.get_writer(block_num, StaticFileSegment::Receipts)?;
// finally actually truncate, these internally commit
receipts_writer.truncate(StaticFileSegment::Receipts, total_txs, Some(block_num))?;
transactions_writer.truncate(
StaticFileSegment::Transactions,
total_txs,
Some(block_num),
)?;
header_writer.truncate(
StaticFileSegment::Headers,
highest_static_file_block.saturating_sub(block_num),
None,
)?;
receipts_writer.prune_receipts(total_txs, block_num)?;
transactions_writer.prune_transactions(total_txs, block_num)?;
header_writer.prune_headers(highest_static_file_block.saturating_sub(block_num))?;
sf_provider.commit()?;
Ok(())
}

View File

@ -338,7 +338,7 @@ impl StaticFileProviderRW {
///
/// # Note
/// Commits to the configuration file at the end.
pub fn truncate(
fn truncate(
&mut self,
segment: StaticFileSegment,
num_rows: u64,