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 {
|
if pluginNetworkId := pluginNetworkId(); pluginNetworkId != nil {
|
||||||
cfg.NetworkId = *pluginNetworkId
|
cfg.NetworkId = *pluginNetworkId
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.EthDiscoveryURLs == nil {
|
if cfg.EthDiscoveryURLs == nil {
|
||||||
var lightMode bool
|
var lightMode bool
|
||||||
if cfg.SyncMode == downloader.LightSync {
|
if cfg.SyncMode == downloader.LightSync {
|
||||||
lightMode = true
|
lightMode = true
|
||||||
}
|
}
|
||||||
cfg.EthDiscoveryURLs = pluginETHDiscoveryURLs(lightMode)
|
cfg.EthDiscoveryURLs = pluginETHDiscoveryURLs(lightMode)
|
||||||
cfg.SnapDiscoveryURLs = pluginSnapDiscoveryURLs()
|
cfg.SnapDiscoveryURLs = pluginSnapDiscoveryURLs()
|
||||||
}
|
}
|
||||||
//end PluGeth injection
|
//end PluGeth injection
|
||||||
@ -2204,6 +2203,11 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
|
|||||||
case ctx.Bool(DeveloperFlag.Name):
|
case ctx.Bool(DeveloperFlag.Name):
|
||||||
Fatalf("Developer chains are ephemeral")
|
Fatalf("Developer chains are ephemeral")
|
||||||
}
|
}
|
||||||
|
//begin plugeth injection
|
||||||
|
if genesis == nil {
|
||||||
|
genesis = pluginGenesisBlock()
|
||||||
|
}
|
||||||
|
//end plugeth injection
|
||||||
return genesis
|
return genesis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func DefaultDataDir(pl *plugins.PluginLoader, path string) string {
|
func DefaultDataDir(pl *plugins.PluginLoader, path string) string {
|
||||||
dataDirPath := ""
|
dataDirPath := ""
|
||||||
fnList := pl.Lookup("SetDefaultDataDir", func(item interface{}) bool {
|
fnList := pl.Lookup("DefaultDataDir", func(item interface{}) bool {
|
||||||
_, ok := item.(func(string) string)
|
_, ok := item.(func(string) string)
|
||||||
return ok
|
return ok
|
||||||
})
|
})
|
||||||
@ -80,7 +80,7 @@ func PluginETHDiscoveryURLs(pl *plugins.PluginLoader, mode bool) []string {
|
|||||||
return ok
|
return ok
|
||||||
})
|
})
|
||||||
for _, fni := range fnList {
|
for _, fni := range fnList {
|
||||||
if fn, ok := fni.(func(bool) []string); ok {
|
if fn, ok := fni.(func(mode bool) []string); ok {
|
||||||
ethDiscoveryURLs = fn(mode)
|
ethDiscoveryURLs = fn(mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,4 +136,4 @@ func pluginGenesisBlock() *core.Genesis {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return PluginGenesisBlock(plugins.DefaultPluginLoader)
|
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 lv.Kind() != reflect.Invalid {
|
||||||
// If core.ChainConfig doesn't have this field, skip it.
|
// If core.ChainConfig doesn't have this field, skip it.
|
||||||
if v.Type() == lv.Type() && lv.CanSet() {
|
if v.Type() == lv.Type() && lv.CanSet() {
|
||||||
lv.Set(v)
|
v.Set(lv)
|
||||||
} else {
|
} else {
|
||||||
convertAndSet(lv, v)
|
convertAndSet(v, lv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user