Add genesis block from plugins

This commit is contained in:
Austin Roberts 2023-10-02 13:18:05 -05:00
parent f7ad35eae9
commit 07e9739871
4 changed files with 274 additions and 270 deletions

View File

@ -1698,7 +1698,6 @@ 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 {
@ -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
}

View File

@ -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)
}
}

View File

@ -22,7 +22,7 @@
"nonce": "0x0",
"timestamp": "0x603e6caa",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f2c207111cb6ef761e439e56b25c7c99ac026a010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x47b760",
"gasLimit": "0x1c9c380",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",

View File

@ -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)
}
}
}