Skip to content

Commit 0723407

Browse files
erigon snapshots check-commitment-hist-at-blk-range: prevent check blocks beyond state (#19597)
1 parent b647574 commit 0723407

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

db/integrity/commitment_integirty.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,10 @@ func CheckCommitmentHistAtBlk(ctx context.Context, db kv.TemporalRoDB, br servic
759759
if err != nil {
760760
return err
761761
}
762+
if aggMax := db.(state.HasAgg).Agg().(*state.Aggregator).EndTxNumMinimax(); maxTxNum+1 > aggMax { // don't use .SeekCommitment to check "state progress" - because we are in method which checking "files validity" (can't rely on them here)
763+
blockNumOfState, _, _ := txNumsReader.FindBlockNum(ctx, tx, aggMax)
764+
return fmt.Errorf("block %d is beyond latest block with state %d", blockNum, blockNumOfState)
765+
}
762766
toTxNum := maxTxNum + 1
763767
sd, err := execctx.NewSharedDomains(ctx, tx, logger)
764768
if err != nil {

0 commit comments

Comments
 (0)