mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
fix(provider): prune account changesets from static files in remove_state_above (#21605)
This commit is contained in:
@@ -2498,10 +2498,7 @@ impl<TX: DbTxMut + DbTx + 'static, N: NodeTypesForProvider> StateWriter
|
||||
block_bodies.first().expect("already checked if there are blocks").first_tx_num();
|
||||
|
||||
let storage_range = BlockNumberAddress::range(range.clone());
|
||||
let storage_changeset = if let Some(_highest_block) = self
|
||||
.static_file_provider
|
||||
.get_highest_static_file_block(StaticFileSegment::StorageChangeSets) &&
|
||||
self.cached_storage_settings().storage_changesets_in_static_files
|
||||
let storage_changeset = if self.cached_storage_settings().storage_changesets_in_static_files
|
||||
{
|
||||
let changesets = self.storage_changesets_range(range.clone())?;
|
||||
let mut changeset_writer =
|
||||
@@ -2511,7 +2508,16 @@ impl<TX: DbTxMut + DbTx + 'static, N: NodeTypesForProvider> StateWriter
|
||||
} else {
|
||||
self.take::<tables::StorageChangeSets>(storage_range)?
|
||||
};
|
||||
let account_changeset = self.take::<tables::AccountChangeSets>(range)?;
|
||||
let account_changeset = if self.cached_storage_settings().account_changesets_in_static_files
|
||||
{
|
||||
let changesets = self.account_changesets_range(range)?;
|
||||
let mut changeset_writer =
|
||||
self.static_file_provider.latest_writer(StaticFileSegment::AccountChangeSets)?;
|
||||
changeset_writer.prune_account_changesets(block)?;
|
||||
changesets
|
||||
} else {
|
||||
self.take::<tables::AccountChangeSets>(range)?
|
||||
};
|
||||
|
||||
// This is not working for blocks that are not at tip. as plain state is not the last
|
||||
// state of end range. We should rename the functions or add support to access
|
||||
|
||||
Reference in New Issue
Block a user