cdk-erigon - ChainDB name is not recognized
chain = ctx.String(ChainFlag.Name)
if strings.HasPrefix(chain, "dynamic") {
configFilePath := ctx.String(ConfigFlag.Name)
if configFilePath == "" {
Fatalf("Config file is required for dynamic chain")
}
// Be sure to set this first
params.DynamicChainConfigPath = filepath.Dir(configFilePath)
filename := path.Join(params.DynamicChainConfigPath, chain+"-conf.json")
genesis := core.GenesisBlockByChainName(chain)
dConf := DynamicConfig{}
if _, err := os.Stat(filename); err == nil {
dConfBytes, err := os.ReadFile(filename)
if err != nil {
panic(err)
}
if err := json.Unmarshal(dConfBytes, &dConf); err != nil {
panic(err)
}
}
genesis.Timestamp = dConf.Timestamp
genesis.GasLimit = dConf.GasLimit
genesis.Difficulty = big.NewInt(dConf.Difficulty)
cfg.Genesis = genesis
genesisHash := libcommon.HexToHash(dConf.Root)
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkID = params.NetworkIDByChainName(chain)
}
SetDNSDiscoveryDefaults(cfg, genesisHash)
} else {
switch chain {
default:
genesis := core.GenesisBlockByChainName(chain)
genesisHash := params.GenesisHashByChainName(chain)
if (genesis == nil) || (genesisHash == nil) {
Fatalf("ChainDB name is not recognized: %s", chain)
新建的自定义链,名称需要以dynamic
关键词,例如dynamic-bcskill-testnet
, 否则会获取对应的hash进行比对