mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: use each prune segment method on remove_blocks_above (#9568)
This commit is contained in:
@ -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(())
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user