mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
set verkle mode from genesis with override (#308)
* set verkle mode from genesis with override * make linter happy * fix more linter snafu
This commit is contained in:
parent
bea12cc674
commit
95d7f39db5
2 changed files with 7 additions and 2 deletions
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
@ -215,7 +214,7 @@ func initGenesis(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
triedb := trie.NewDatabaseWithConfig(chaindb, &trie.Config{
|
triedb := trie.NewDatabaseWithConfig(chaindb, &trie.Config{
|
||||||
Preimages: ctx.Bool(utils.CachePreimagesFlag.Name),
|
Preimages: ctx.Bool(utils.CachePreimagesFlag.Name),
|
||||||
Verkle: genesis.Config.IsPrague(big.NewInt(0), genesis.Timestamp),
|
Verkle: genesis.IsVerkle(),
|
||||||
})
|
})
|
||||||
_, hash, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides)
|
_, hash, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -456,6 +456,12 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsVerkle indicates whether the state is already stored in a verkle
|
||||||
|
// tree at genesis time.
|
||||||
|
func (g *Genesis) IsVerkle() bool {
|
||||||
|
return g.Config.IsPrague(new(big.Int).SetUint64(g.Number), g.Timestamp)
|
||||||
|
}
|
||||||
|
|
||||||
// ToBlock returns the genesis block according to genesis specification.
|
// ToBlock returns the genesis block according to genesis specification.
|
||||||
func (g *Genesis) ToBlock() *types.Block {
|
func (g *Genesis) ToBlock() *types.Block {
|
||||||
root, err := g.Alloc.deriveHash(g.Config, g.Timestamp)
|
root, err := g.Alloc.deriveHash(g.Config, g.Timestamp)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue