trie: only check ~5% of all trie nodes

This commit is contained in:
Marius van der Wijden 2023-11-15 14:40:15 +01:00
parent 08be7f116a
commit 65bebf30ec

View file

@ -19,6 +19,7 @@ package trie
import (
"bytes"
"fmt"
"math/rand"
"testing"
"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
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))
nodeHash := addedHashes[i]
value := rawdb.ReadTrieNode(diskdb, owner, inner, nodeHash, scheme)