mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
10fffa6e7c
* add in flags * add sync and db items * bring over all other changes * enable on * use feature flag * powchain * builds * fix up tests * pass iface * gaz * enable bellatrix blind in unmarshal only behind flag * poolside * pass rpc tests * rebuilds * naming * cleaner func * check needs resync * idiomatic * gaz * rem * build * nicer * build * cleaner * surface error * wrapping * unmarshal logs * fix up * cleaner * log * builds * Update beacon-chain/blockchain/execution_engine.go Co-authored-by: terencechain <terence@prysmaticlabs.com> * terence feedback * test added for resync * nil check * fmt Co-authored-by: terencechain <terence@prysmaticlabs.com>
35 lines
925 B
Go
35 lines
925 B
Go
package kv
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/config/features"
|
|
"github.com/prysmaticlabs/prysm/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)
|
|
}
|