diff --git a/crates/stages/src/stages/bodies.rs b/crates/stages/src/stages/bodies.rs index 459eace720..312c465798 100644 --- a/crates/stages/src/stages/bodies.rs +++ b/crates/stages/src/stages/bodies.rs @@ -343,7 +343,11 @@ fn stage_checkpoint( ) -> ProviderResult { Ok(EntitiesCheckpoint { processed: provider.count_entries::()? as u64, - total: (provider.count_entries::()? as u64).saturating_sub(1), + // Count only static files entries. If we count the database entries too, we may have + // duplicates. We're sure that the static files have all entries that database has, + // because we run the `StaticFileProducer` before starting the pipeline. + total: (provider.static_file_provider().count_entries::()? as u64) + .saturating_sub(1), }) } diff --git a/crates/stages/src/stages/sender_recovery.rs b/crates/stages/src/stages/sender_recovery.rs index 79e4263661..6ec8f71cb3 100644 --- a/crates/stages/src/stages/sender_recovery.rs +++ b/crates/stages/src/stages/sender_recovery.rs @@ -221,7 +221,10 @@ fn stage_checkpoint( // matching the actual number of processed transactions. To fix that, we add the // number of pruned `TransactionSenders` entries. processed: provider.count_entries::()? as u64 + pruned_entries, - total: provider.count_entries::()? as u64, + // Count only static files entries. If we count the database entries too, we may have + // duplicates. We're sure that the static files have all entries that database has, + // because we run the `StaticFileProducer` before starting the pipeline. + total: provider.static_file_provider().count_entries::()? as u64, }) } diff --git a/crates/stages/src/stages/tx_lookup.rs b/crates/stages/src/stages/tx_lookup.rs index ac68997541..ef1f51eefa 100644 --- a/crates/stages/src/stages/tx_lookup.rs +++ b/crates/stages/src/stages/tx_lookup.rs @@ -219,7 +219,10 @@ fn stage_checkpoint( // number of pruned `TransactionHashNumbers` entries. processed: provider.count_entries::()? as u64 + pruned_entries, - total: provider.count_entries::()? as u64, + // Count only static files entries. If we count the database entries too, we may have + // duplicates. We're sure that the static files have all entries that database has, + // because we run the `StaticFileProducer` before starting the pipeline. + total: provider.static_file_provider().count_entries::()? as u64, }) }