mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
trie/pathdb: decode verkle node in loadLayer
This commit is contained in:
parent
08e6bdb550
commit
65255f1651
1 changed files with 10 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/ethereum/go-verkle"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -95,7 +96,15 @@ func (db *Database) loadLayers() layer {
|
|||
// Retrieve the root node of persistent state.
|
||||
var root = types.EmptyRootHash
|
||||
if blob := rawdb.ReadAccountTrieNode(db.diskdb, nil); len(blob) > 0 {
|
||||
root = crypto.Keccak256Hash(blob)
|
||||
if db.isVerkle {
|
||||
rootnode, err := verkle.ParseNode(blob, 0)
|
||||
if err != nil {
|
||||
log.Crit("Could not decode verkle root node")
|
||||
}
|
||||
root = rootnode.Commit().Bytes()
|
||||
} else {
|
||||
root = crypto.Keccak256Hash(blob)
|
||||
}
|
||||
}
|
||||
// Load the layers by resolving the journal
|
||||
head, err := db.loadJournal(root)
|
||||
|
|
|
|||
Loading…
Reference in a new issue