fix: support a verkle pre-tree at the conversion block (#313)

* fix: support a verkle pre-tree at the conversion block

* make linter happy
This commit is contained in:
Guillaume Ballet 2024-01-29 09:52:45 +01:00
parent ac3f26947d
commit 7d02a604d7

View file

@ -418,7 +418,14 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
vtrpost = post.Overlay() vtrpost = post.Overlay()
okpost = true okpost = true
default: default:
panic("invalid tree type") // This should only happen for the first block of the
// conversion, when the previous tree is a merkle tree.
// Logically, the "previous" verkle tree is an empty tree.
okpre = true
vtrpre = trie.NewVerkleTrie(verkle.New(), state.Database().TrieDB(), utils.NewPointCache(), false)
post := state.GetTrie().(*trie.TransitionTrie)
vtrpost = post.Overlay()
okpost = true
} }
if okpre && okpost { if okpre && okpost {
if len(keys) > 0 { if len(keys) > 0 {