mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 21:26:42 +00:00
triedb/pathdb: fix flaky test
This commit is contained in:
parent
cb669c1e32
commit
15c77d3c74
1 changed files with 14 additions and 2 deletions
|
|
@ -230,6 +230,8 @@ func (t *tester) extend(layers int) {
|
||||||
panic(fmt.Errorf("failed to update state changes, err: %w", err))
|
panic(fmt.Errorf("failed to update state changes, err: %w", err))
|
||||||
}
|
}
|
||||||
t.roots = append(t.roots, root)
|
t.roots = append(t.roots, root)
|
||||||
|
t.nodes = append(t.nodes, nodes)
|
||||||
|
t.states = append(t.states, states)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -931,13 +933,23 @@ func TestDatabaseIndexRecovery(t *testing.T) {
|
||||||
}
|
}
|
||||||
env := newTester(t, config)
|
env := newTester(t, config)
|
||||||
defer env.release()
|
defer env.release()
|
||||||
|
|
||||||
|
// Ensure the buffer in disk layer is not empty
|
||||||
|
var (
|
||||||
|
bRoot = env.db.tree.bottom().rootHash()
|
||||||
|
dRoot = crypto.Keccak256Hash(rawdb.ReadAccountTrieNode(env.db.diskdb, nil))
|
||||||
|
)
|
||||||
|
for dRoot == bRoot {
|
||||||
|
env.extend(1)
|
||||||
|
|
||||||
|
bRoot = env.db.tree.bottom().rootHash()
|
||||||
|
dRoot = crypto.Keccak256Hash(rawdb.ReadAccountTrieNode(env.db.diskdb, nil))
|
||||||
|
}
|
||||||
waitIndexing(env.db)
|
waitIndexing(env.db)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
dIndex int
|
dIndex int
|
||||||
roots = env.roots
|
roots = env.roots
|
||||||
bRoot = env.db.tree.bottom().rootHash()
|
|
||||||
dRoot = crypto.Keccak256Hash(rawdb.ReadAccountTrieNode(env.db.diskdb, nil))
|
|
||||||
hr = newHistoryReader(env.db.diskdb, env.db.stateFreezer)
|
hr = newHistoryReader(env.db.diskdb, env.db.stateFreezer)
|
||||||
)
|
)
|
||||||
for i, root := range roots {
|
for i, root := range roots {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue