mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-16 06:58:20 +00:00
d077483577
* v3 import renamings * tidy * fmt * rev * Update beacon-chain/core/epoch/precompute/reward_penalty_test.go * Update beacon-chain/core/helpers/validators_test.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/iface/BUILD.bazel * Update beacon-chain/db/kv/kv.go * Update beacon-chain/db/kv/state.go * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go * Update beacon-chain/sync/initial-sync/service.go * fix deps * fix bad replacements * fix bad replacements * change back * gohashtree version * fix deps Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: Potuz <potuz@prysmaticlabs.com>
35 lines
931 B
Go
35 lines
931 B
Go
package kv
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/config/features"
|
|
"github.com/prysmaticlabs/prysm/v3/testing/require"
|
|
bolt "go.etcd.io/bbolt"
|
|
)
|
|
|
|
// setupDB instantiates and returns a Store instance.
|
|
func setupDB(t testing.TB) *Store {
|
|
db, err := NewKVStore(context.Background(), t.TempDir(), &Config{})
|
|
require.NoError(t, err, "Failed to instantiate DB")
|
|
t.Cleanup(func() {
|
|
require.NoError(t, db.Close(), "Failed to close database")
|
|
})
|
|
return db
|
|
}
|
|
|
|
func Test_checkNeedsResync(t *testing.T) {
|
|
store := setupDB(t)
|
|
resetFn := features.InitWithReset(&features.Flags{
|
|
EnableOnlyBlindedBeaconBlocks: false,
|
|
})
|
|
defer resetFn()
|
|
require.NoError(t, store.db.Update(func(tx *bolt.Tx) error {
|
|
bkt := tx.Bucket(migrationsBucket)
|
|
return bkt.Put(migrationBlindedBeaconBlocksKey, migrationCompleted)
|
|
}))
|
|
err := store.checkNeedsResync()
|
|
require.ErrorContains(t, "your node must resync", err)
|
|
}
|