Skip to content

Commit

Permalink
fix: make sure to commit static file provider on stage run (paradig…
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo authored Jun 19, 2024
1 parent e2b8254 commit 50cf64b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/reth/src/commands/stage/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use reth_downloaders::bodies::bodies::BodiesDownloaderBuilder;
use reth_exex::ExExManagerHandle;
use reth_provider::{
ChainSpecProvider, StageCheckpointReader, StageCheckpointWriter, StaticFileProviderFactory,
StaticFileWriter,
};
use reth_stages::{
stages::{
Expand Down Expand Up @@ -253,7 +254,12 @@ impl Command {
}

if self.commit {
// For unwinding it makes more sense to commit the database first, since if
// this function is interrupted before the static files commit, we can just
// truncate the static files according to the
// checkpoints on the next start-up.
provider_rw.commit()?;
provider_factory.static_file_provider().commit()?;
provider_rw = provider_factory.provider_rw()?;
}
}
Expand All @@ -276,6 +282,7 @@ impl Command {
provider_rw.save_stage_checkpoint(exec_stage.id(), checkpoint)?;
}
if self.commit {
provider_factory.static_file_provider().commit()?;
provider_rw.commit()?;
provider_rw = provider_factory.provider_rw()?;
}
Expand Down

0 comments on commit 50cf64b

Please sign in to comment.