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/crypto"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
|
"github.com/ethereum/go-verkle"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -95,8 +96,16 @@ func (db *Database) loadLayers() layer {
|
||||||
// Retrieve the root node of persistent state.
|
// Retrieve the root node of persistent state.
|
||||||
var root = types.EmptyRootHash
|
var root = types.EmptyRootHash
|
||||||
if blob := rawdb.ReadAccountTrieNode(db.diskdb, nil); len(blob) > 0 {
|
if blob := rawdb.ReadAccountTrieNode(db.diskdb, nil); len(blob) > 0 {
|
||||||
|
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)
|
root = crypto.Keccak256Hash(blob)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Load the layers by resolving the journal
|
// Load the layers by resolving the journal
|
||||||
head, err := db.loadJournal(root)
|
head, err := db.loadJournal(root)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue