Add genesis block from plugins
This commit is contained in:
parent
f7ad35eae9
commit
07e9739871
@ -1698,13 +1698,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||
if pluginNetworkId := pluginNetworkId(); pluginNetworkId != nil {
|
||||
cfg.NetworkId = *pluginNetworkId
|
||||
}
|
||||
|
||||
if cfg.EthDiscoveryURLs == nil {
|
||||
var lightMode bool
|
||||
if cfg.SyncMode == downloader.LightSync {
|
||||
lightMode = true
|
||||
}
|
||||
cfg.EthDiscoveryURLs = pluginETHDiscoveryURLs(lightMode)
|
||||
cfg.EthDiscoveryURLs = pluginETHDiscoveryURLs(lightMode)
|
||||
cfg.SnapDiscoveryURLs = pluginSnapDiscoveryURLs()
|
||||
}
|
||||
//end PluGeth injection
|
||||
@ -2204,6 +2203,11 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
|
||||
case ctx.Bool(DeveloperFlag.Name):
|
||||
Fatalf("Developer chains are ephemeral")
|
||||
}
|
||||
//begin plugeth injection
|
||||
if genesis == nil {
|
||||
genesis = pluginGenesisBlock()
|
||||
}
|
||||
//end plugeth injection
|
||||
return genesis
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func DefaultDataDir(pl *plugins.PluginLoader, path string) string {
|
||||
dataDirPath := ""
|
||||
fnList := pl.Lookup("SetDefaultDataDir", func(item interface{}) bool {
|
||||
fnList := pl.Lookup("DefaultDataDir", func(item interface{}) bool {
|
||||
_, ok := item.(func(string) string)
|
||||
return ok
|
||||
})
|
||||
@ -80,7 +80,7 @@ func PluginETHDiscoveryURLs(pl *plugins.PluginLoader, mode bool) []string {
|
||||
return ok
|
||||
})
|
||||
for _, fni := range fnList {
|
||||
if fn, ok := fni.(func(bool) []string); ok {
|
||||
if fn, ok := fni.(func(mode bool) []string); ok {
|
||||
ethDiscoveryURLs = fn(mode)
|
||||
}
|
||||
}
|
||||
@ -136,4 +136,4 @@ func pluginGenesisBlock() *core.Genesis {
|
||||
return nil
|
||||
}
|
||||
return PluginGenesisBlock(plugins.DefaultPluginLoader)
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -482,9 +482,9 @@ func CloneChainConfig(cf *gparams.ChainConfig) *params.ChainConfig {
|
||||
if lv.Kind() != reflect.Invalid {
|
||||
// If core.ChainConfig doesn't have this field, skip it.
|
||||
if v.Type() == lv.Type() && lv.CanSet() {
|
||||
lv.Set(v)
|
||||
v.Set(lv)
|
||||
} else {
|
||||
convertAndSet(lv, v)
|
||||
convertAndSet(v, lv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user