mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
triedb/pathdb: fix tests
This commit is contained in:
parent
436edce468
commit
e0cc4df422
2 changed files with 15 additions and 14 deletions
|
|
@ -121,15 +121,16 @@ type tester struct {
|
|||
snapStorages map[common.Hash]map[common.Hash]map[common.Hash][]byte // Keyed by the hash of account address and the hash of storage key
|
||||
}
|
||||
|
||||
func newTester(t *testing.T, historyLimit uint64, isVerkle bool, layers int) *tester {
|
||||
func newTester(t *testing.T, historyLimit uint64, isVerkle bool, layers int, enableIndex bool) *tester {
|
||||
var (
|
||||
disk, _ = rawdb.Open(rawdb.NewMemoryDatabase(), rawdb.OpenOptions{Ancient: t.TempDir()})
|
||||
db = New(disk, &Config{
|
||||
StateHistory: historyLimit,
|
||||
TrieCleanSize: 256 * 1024,
|
||||
StateCleanSize: 256 * 1024,
|
||||
WriteBufferSize: 256 * 1024,
|
||||
NoAsyncFlush: true,
|
||||
StateHistory: historyLimit,
|
||||
EnableStateIndexing: enableIndex,
|
||||
TrieCleanSize: 256 * 1024,
|
||||
StateCleanSize: 256 * 1024,
|
||||
WriteBufferSize: 256 * 1024,
|
||||
NoAsyncFlush: true,
|
||||
}, isVerkle)
|
||||
|
||||
obj = &tester{
|
||||
|
|
@ -465,7 +466,7 @@ func TestDatabaseRollback(t *testing.T) {
|
|||
}()
|
||||
|
||||
// Verify state histories
|
||||
tester := newTester(t, 0, false, 32)
|
||||
tester := newTester(t, 0, false, 32, false)
|
||||
defer tester.release()
|
||||
|
||||
if err := tester.verifyHistory(); err != nil {
|
||||
|
|
@ -499,7 +500,7 @@ func TestDatabaseRecoverable(t *testing.T) {
|
|||
}()
|
||||
|
||||
var (
|
||||
tester = newTester(t, 0, false, 12)
|
||||
tester = newTester(t, 0, false, 12, false)
|
||||
index = tester.bottomIndex()
|
||||
)
|
||||
defer tester.release()
|
||||
|
|
@ -543,7 +544,7 @@ func TestDisable(t *testing.T) {
|
|||
maxDiffLayers = 128
|
||||
}()
|
||||
|
||||
tester := newTester(t, 0, false, 32)
|
||||
tester := newTester(t, 0, false, 32, false)
|
||||
defer tester.release()
|
||||
|
||||
stored := crypto.Keccak256Hash(rawdb.ReadAccountTrieNode(tester.db.diskdb, nil))
|
||||
|
|
@ -585,7 +586,7 @@ func TestCommit(t *testing.T) {
|
|||
maxDiffLayers = 128
|
||||
}()
|
||||
|
||||
tester := newTester(t, 0, false, 12)
|
||||
tester := newTester(t, 0, false, 12, false)
|
||||
defer tester.release()
|
||||
|
||||
if err := tester.db.Commit(tester.lastHash(), false); err != nil {
|
||||
|
|
@ -615,7 +616,7 @@ func TestJournal(t *testing.T) {
|
|||
maxDiffLayers = 128
|
||||
}()
|
||||
|
||||
tester := newTester(t, 0, false, 12)
|
||||
tester := newTester(t, 0, false, 12, false)
|
||||
defer tester.release()
|
||||
|
||||
if err := tester.db.Journal(tester.lastHash()); err != nil {
|
||||
|
|
@ -645,7 +646,7 @@ func TestCorruptedJournal(t *testing.T) {
|
|||
maxDiffLayers = 128
|
||||
}()
|
||||
|
||||
tester := newTester(t, 0, false, 12)
|
||||
tester := newTester(t, 0, false, 12, false)
|
||||
defer tester.release()
|
||||
|
||||
if err := tester.db.Journal(tester.lastHash()); err != nil {
|
||||
|
|
@ -693,7 +694,7 @@ func TestTailTruncateHistory(t *testing.T) {
|
|||
maxDiffLayers = 128
|
||||
}()
|
||||
|
||||
tester := newTester(t, 10, false, 12)
|
||||
tester := newTester(t, 10, false, 12, false)
|
||||
defer tester.release()
|
||||
|
||||
tester.db.Close()
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ func testHistoryReader(t *testing.T, historyLimit uint64) {
|
|||
}()
|
||||
//log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelDebug, true)))
|
||||
|
||||
env := newTester(t, historyLimit, false, 64)
|
||||
env := newTester(t, historyLimit, false, 64, true)
|
||||
defer env.release()
|
||||
waitIndexing(env.db)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue