fix: make sure to commit static file provider on stage run (#8972)

This commit is contained in:
joshieDo
2024-06-20 00:55:24 +02:00
committed by GitHub
parent e2b8254a3d
commit 50cf64bfbb

View File

@@ -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::{
@@ -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()?;
}
}
@@ -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()?;
}