mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
tests/fuzzers/stacktrie: update
This commit is contained in:
parent
18771a7339
commit
33acd161d2
1 changed files with 3 additions and 6 deletions
|
|
@ -140,8 +140,8 @@ func (f *fuzzer) fuzz() int {
|
||||||
trieA = trie.NewEmpty(dbA)
|
trieA = trie.NewEmpty(dbA)
|
||||||
spongeB = &spongeDb{sponge: sha3.NewLegacyKeccak256()}
|
spongeB = &spongeDb{sponge: sha3.NewLegacyKeccak256()}
|
||||||
dbB = trie.NewDatabase(rawdb.NewDatabase(spongeB), nil)
|
dbB = trie.NewDatabase(rawdb.NewDatabase(spongeB), nil)
|
||||||
trieB = trie.NewStackTrie(func(owner common.Hash, path []byte, hash common.Hash, blob []byte) {
|
trieB = trie.NewStackTrie(func(path []byte, hash common.Hash, blob []byte) {
|
||||||
rawdb.WriteTrieNode(spongeB, owner, path, hash, blob, dbB.Scheme())
|
rawdb.WriteTrieNode(spongeB, common.Hash{}, path, hash, blob, dbB.Scheme())
|
||||||
})
|
})
|
||||||
vals []kv
|
vals []kv
|
||||||
useful bool
|
useful bool
|
||||||
|
|
@ -205,13 +205,10 @@ func (f *fuzzer) fuzz() int {
|
||||||
// Ensure all the nodes are persisted correctly
|
// Ensure all the nodes are persisted correctly
|
||||||
var (
|
var (
|
||||||
nodeset = make(map[string][]byte) // path -> blob
|
nodeset = make(map[string][]byte) // path -> blob
|
||||||
trieC = trie.NewStackTrie(func(owner common.Hash, path []byte, hash common.Hash, blob []byte) {
|
trieC = trie.NewStackTrie(func(path []byte, hash common.Hash, blob []byte) {
|
||||||
if crypto.Keccak256Hash(blob) != hash {
|
if crypto.Keccak256Hash(blob) != hash {
|
||||||
panic("invalid node blob")
|
panic("invalid node blob")
|
||||||
}
|
}
|
||||||
if owner != (common.Hash{}) {
|
|
||||||
panic("invalid node owner")
|
|
||||||
}
|
|
||||||
nodeset[string(path)] = common.CopyBytes(blob)
|
nodeset[string(path)] = common.CopyBytes(blob)
|
||||||
})
|
})
|
||||||
checked int
|
checked int
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue