mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Revert "WIP: fix flaky TestDisable"
This reverts commit 7936ffcc6964dd21b032ab4555b0a6d7ccc0fbeb.
This commit is contained in:
parent
9d0913ede9
commit
bd88d359b0
2 changed files with 1 additions and 13 deletions
|
|
@ -310,10 +310,6 @@ func (db *Database) Enable(root common.Hash) error {
|
||||||
stored := types.EmptyRootHash
|
stored := types.EmptyRootHash
|
||||||
if blob := rawdb.ReadAccountTrieNode(db.diskdb, nil); len(blob) > 0 {
|
if blob := rawdb.ReadAccountTrieNode(db.diskdb, nil); len(blob) > 0 {
|
||||||
stored = crypto.Keccak256Hash(blob)
|
stored = crypto.Keccak256Hash(blob)
|
||||||
} else {
|
|
||||||
has, err := db.diskdb.Has(nil)
|
|
||||||
fmt.Println("len(blob) == 0", has, err)
|
|
||||||
fmt.Printf("state root mismatch: stored %x, synced %x\n", stored, root)
|
|
||||||
}
|
}
|
||||||
if stored != root {
|
if stored != root {
|
||||||
return fmt.Errorf("state root mismatch: stored %x, synced %x", stored, root)
|
return fmt.Errorf("state root mismatch: stored %x, synced %x", stored, root)
|
||||||
|
|
|
||||||
|
|
@ -476,13 +476,6 @@ func TestDatabaseRecoverable(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDisableManyTimes(t *testing.T) {
|
|
||||||
for i := 0; i < 1000; i++ {
|
|
||||||
t.Log(i)
|
|
||||||
TestDisable(t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestDisable(t *testing.T) {
|
func TestDisable(t *testing.T) {
|
||||||
// Redefine the diff layer depth allowance for faster testing.
|
// Redefine the diff layer depth allowance for faster testing.
|
||||||
maxDiffLayers = 4
|
maxDiffLayers = 4
|
||||||
|
|
@ -493,14 +486,13 @@ func TestDisable(t *testing.T) {
|
||||||
tester := newTester(t, 0)
|
tester := newTester(t, 0)
|
||||||
defer tester.release()
|
defer tester.release()
|
||||||
|
|
||||||
|
stored := crypto.Keccak256Hash(rawdb.ReadAccountTrieNode(tester.db.diskdb, nil))
|
||||||
if err := tester.db.Disable(); err != nil {
|
if err := tester.db.Disable(); err != nil {
|
||||||
t.Fatalf("Failed to deactivate database: %v", err)
|
t.Fatalf("Failed to deactivate database: %v", err)
|
||||||
}
|
}
|
||||||
fmt.Println(tester.db.diskdb.Has(nil))
|
|
||||||
if err := tester.db.Enable(types.EmptyRootHash); err == nil {
|
if err := tester.db.Enable(types.EmptyRootHash); err == nil {
|
||||||
t.Fatal("Invalid activation should be rejected")
|
t.Fatal("Invalid activation should be rejected")
|
||||||
}
|
}
|
||||||
stored := crypto.Keccak256Hash(rawdb.ReadAccountTrieNode(tester.db.diskdb, nil))
|
|
||||||
if err := tester.db.Enable(stored); err != nil {
|
if err := tester.db.Enable(stored); err != nil {
|
||||||
t.Fatalf("Failed to activate database: %v", err)
|
t.Fatalf("Failed to activate database: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue