feat(storage, tree): respect Transaction Lookup pruning in the blockchain tree (#4410)

This commit is contained in:
Alexey Shekhirin
2023-09-01 13:51:34 +01:00
committed by GitHub
parent 39a6fa1b57
commit e66e3e3556
29 changed files with 118 additions and 49 deletions

View File

@ -193,7 +193,7 @@ impl Command {
let provider_rw = factory.provider_rw()?;
// Insert block, state and hashes
provider_rw.insert_block(block.clone(), None)?;
provider_rw.insert_block(block.clone(), None, None)?;
block_state.write_to_db(provider_rw.tx_ref(), block.number)?;
let storage_lists = provider_rw.changed_storages_with_range(block.number..=block.number)?;
let storages = provider_rw.plainstate_storages(storage_lists)?;

View File

@ -185,7 +185,7 @@ impl Command {
continue
}
};
provider_rw.insert_block(sealed_block.block, Some(sealed_block.senders))?;
provider_rw.insert_block(sealed_block.block, Some(sealed_block.senders), None)?;
}
// Check if any of hashing or merkle stages aren't on the same block number as

View File

@ -267,6 +267,9 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
let metrics_listener = MetricsListener::new(metrics_rx);
ctx.task_executor.spawn_critical("metrics listener task", metrics_listener);
let prune_config =
self.pruning.prune_config(Arc::clone(&self.chain))?.or(config.prune.clone());
// configure blockchain tree
let tree_externals = TreeExternals::new(
db.clone(),
@ -284,6 +287,7 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
tree_externals,
canon_state_notification_sender.clone(),
tree_config,
prune_config.clone().map(|config| config.parts),
)?
.with_sync_metrics_tx(metrics_tx.clone()),
);
@ -365,9 +369,6 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
None
};
let prune_config =
self.pruning.prune_config(Arc::clone(&self.chain))?.or(config.prune.clone());
// Configure the pipeline
let (mut pipeline, client) = if self.dev.dev {
info!(target: "reth::cli", "Starting Reth in dev mode");