prysm-pulse/beacon-chain/db/kv/migration.go
kasey f3b49d4eaf
Repair idx 13486 (#13831)
* Revert "Modify the algorithm of `updateFinalizedBlockRoots` (#13486)"

This reverts commit 32fb183392.

* migration to fix index corruption from pr 13486

* bail as soon as we see 10 epochs without the bug

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
2024-03-29 17:29:39 +00:00

29 lines
501 B
Go

package kv
import (
"context"
bolt "go.etcd.io/bbolt"
)
var migrationCompleted = []byte("done")
type migration func(context.Context, *bolt.DB) error
var migrations = []migration{
migrateArchivedIndex,
migrateBlockSlotIndex,
migrateStateValidators,
migrateFinalizedParent,
}
// RunMigrations defined in the migrations array.
func (s *Store) RunMigrations(ctx context.Context) error {
for _, m := range migrations {
if err := m(ctx, s.db); err != nil {
return err
}
}
return nil
}