mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
feat: allow syncing op-mainnet with only state and without importing blocks/receipts (#10850)
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@ use tracing::info;
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct InitStateCommand<C: ChainSpecParser> {
|
||||
#[command(flatten)]
|
||||
env: EnvironmentArgs<C>,
|
||||
pub env: EnvironmentArgs<C>,
|
||||
|
||||
/// JSONL file with state dump.
|
||||
///
|
||||
@@ -37,7 +37,7 @@ pub struct InitStateCommand<C: ChainSpecParser> {
|
||||
/// Allows init at a non-genesis block. Caution! Blocks must be manually imported up until
|
||||
/// and including the non-genesis block to init chain at. See 'import' command.
|
||||
#[arg(value_name = "STATE_DUMP_FILE", verbatim_doc_comment)]
|
||||
state: PathBuf,
|
||||
pub state: PathBuf,
|
||||
}
|
||||
|
||||
impl<C: ChainSpecParser<ChainSpec = ChainSpec>> InitStateCommand<C> {
|
||||
@@ -71,5 +71,9 @@ pub fn init_at_state<N: NodeTypesWithDB<ChainSpec = ChainSpec>>(
|
||||
let file = File::open(state_dump_path)?;
|
||||
let reader = BufReader::new(file);
|
||||
|
||||
init_from_state_dump(reader, factory, etl_config)
|
||||
let provider_rw = factory.provider_rw()?;
|
||||
let hash = init_from_state_dump(reader, &provider_rw.0, etl_config)?;
|
||||
provider_rw.commit()?;
|
||||
|
||||
Ok(hash)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user