mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
fix: open an empty storage trie after transition
This commit is contained in:
parent
ff71485e31
commit
f5a7321bef
1 changed files with 18 additions and 2 deletions
|
|
@ -362,8 +362,23 @@ func (db *cachingDB) openStorageMPTrie(stateRoot common.Hash, address common.Add
|
||||||
|
|
||||||
// OpenStorageTrie opens the storage trie of an account
|
// OpenStorageTrie opens the storage trie of an account
|
||||||
func (db *cachingDB) OpenStorageTrie(stateRoot common.Hash, address common.Address, root common.Hash, self Trie) (Trie, error) {
|
func (db *cachingDB) OpenStorageTrie(stateRoot common.Hash, address common.Address, root common.Hash, self Trie) (Trie, error) {
|
||||||
mpt, err := db.openStorageMPTrie(stateRoot, address, root, nil)
|
if db.ended {
|
||||||
if db.started && err == nil {
|
mpt, err := db.openStorageMPTrie(common.Hash{}, address, common.Hash{}, self)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// Return a "storage trie" that is an adapter between the storge MPT
|
||||||
|
// and the unique verkle tree.
|
||||||
|
switch self := self.(type) {
|
||||||
|
case *trie.VerkleTrie:
|
||||||
|
return trie.NewTransitionTree(mpt.(*trie.StateTrie), self, true), nil
|
||||||
|
case *trie.TransitionTrie:
|
||||||
|
return trie.NewTransitionTree(mpt.(*trie.StateTrie), self.Overlay(), true), nil
|
||||||
|
default:
|
||||||
|
panic("unexpected trie type")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if db.started {
|
||||||
// Return a "storage trie" that is an adapter between the storge MPT
|
// Return a "storage trie" that is an adapter between the storge MPT
|
||||||
// and the unique verkle tree.
|
// and the unique verkle tree.
|
||||||
switch self := self.(type) {
|
switch self := self.(type) {
|
||||||
|
|
@ -375,6 +390,7 @@ func (db *cachingDB) OpenStorageTrie(stateRoot common.Hash, address common.Addre
|
||||||
panic("unexpected trie type")
|
panic("unexpected trie type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mpt, err := db.openStorageMPTrie(stateRoot, address, root, nil)
|
||||||
return mpt, err
|
return mpt, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue