mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-26 05:27:19 +00:00
cf7b9a75a7
* Euphemerally -> Ephemerally * Move StorageMode to ethdb and pass it to PrepareStagedSync * linter * Remove StorageModeThinHistory and move SetStorageModeIfNotExist into storage_mode.go * Optionally write receipts in the execute stage * memory profiler * linter * proper linter fix * linter * typo * Merge stateDb with changeDb so that all-or-nothing is commited in stage_execute
46 lines
607 B
Go
46 lines
607 B
Go
package ethdb
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
"github.com/davecgh/go-spew/spew"
|
|
)
|
|
|
|
func TestSetStorageModeIfNotExist(t *testing.T) {
|
|
db := NewMemDatabase()
|
|
sm, err := GetStorageModeFromDB(db)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if !reflect.DeepEqual(sm, StorageMode{}) {
|
|
t.Fatal()
|
|
}
|
|
|
|
err = SetStorageModeIfNotExist(db, StorageMode{
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
sm, err = GetStorageModeFromDB(db)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if !reflect.DeepEqual(sm, StorageMode{
|
|
true,
|
|
true,
|
|
true,
|
|
true,
|
|
}) {
|
|
spew.Dump(sm)
|
|
t.Fatal("not equal")
|
|
}
|
|
}
|