triedb/pathdb: reset index metadata when state pruned

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2025-08-04 15:27:22 +08:00
parent 9570480b4d
commit 1a340075ef

View file

@ -337,6 +337,12 @@ func (db *Database) repairHistory() error {
} }
if pruned != 0 { if pruned != 0 {
log.Warn("Truncated extra state histories", "number", pruned) log.Warn("Truncated extra state histories", "number", pruned)
oldID := uint64(0)
if meta := loadIndexMetadata(db.diskdb); meta != nil {
oldID = meta.Last
}
log.Warn("Reset state history index metadata after truncation", "oldID", oldID, "newID", id)
storeIndexMetadata(db.diskdb, id)
} }
return nil return nil
} }