mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
trie: only check ~5% of all trie nodes
This commit is contained in:
parent
08be7f116a
commit
65bebf30ec
1 changed files with 5 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ package trie
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
@ -585,9 +586,12 @@ func testIncompleteSync(t *testing.T, scheme string) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanity check that removing any node from the database is detected
|
// Sanity check that removing any node from the database is detected
|
||||||
for i, path := range addedKeys {
|
for i, path := range addedKeys {
|
||||||
|
if rand.Int31n(100) > 5 {
|
||||||
|
// Only check 5 percent of added keys as a sanity check
|
||||||
|
continue
|
||||||
|
}
|
||||||
owner, inner := ResolvePath([]byte(path))
|
owner, inner := ResolvePath([]byte(path))
|
||||||
nodeHash := addedHashes[i]
|
nodeHash := addedHashes[i]
|
||||||
value := rawdb.ReadTrieNode(diskdb, owner, inner, nodeHash, scheme)
|
value := rawdb.ReadTrieNode(diskdb, owner, inner, nodeHash, scheme)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue