diff options
Diffstat (limited to 'cmd/utils')
-rw-r--r-- | cmd/utils/flags.go | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index ef79baf1c..1d70245ab 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -296,6 +296,10 @@ var ( Name: "exec", Usage: "Execute JavaScript statement (only in combination with console/attach)", } + PreLoadJSFlag = cli.StringFlag{ + Name: "preload", + Usage: "Comma separated list of JavaScript files to preload into the console", + } // Network Settings MaxPeersFlag = cli.IntFlag{ @@ -776,16 +780,20 @@ func SetupNetwork(ctx *cli.Context) { params.TargetGasLimit = common.String2Big(ctx.GlobalString(TargetGasLimitFlag.Name)) } -// MustMakeChainConfig reads the chain configuration from the given database. +// MustMakeChainConfig reads the chain configuration from the database in ctx.Datadir. func MustMakeChainConfig(ctx *cli.Context) *core.ChainConfig { - var ( - db = MakeChainDatabase(ctx) - genesis = core.GetBlock(db, core.GetCanonicalHash(db, 0)) - ) + db := MakeChainDatabase(ctx) defer db.Close() + return MustMakeChainConfigFromDb(ctx, db) +} + +// MustMakeChainConfigFromDb reads the chain configuration from the given database. +func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *core.ChainConfig { + genesis := core.GetBlock(db, core.GetCanonicalHash(db, 0)) + if genesis != nil { - // Exsting genesis block, use stored config if available. + // Existing genesis block, use stored config if available. storedConfig, err := core.GetChainConfig(db, genesis.Hash()) if err == nil { return storedConfig @@ -829,7 +837,7 @@ func MakeChain(ctx *cli.Context) (chain *core.BlockChain, chainDb ethdb.Database } } - chainConfig := MustMakeChainConfig(ctx) + chainConfig := MustMakeChainConfigFromDb(ctx, chainDb) var eventMux event.TypeMux chain, err = core.NewBlockChain(chainDb, chainConfig, ethash.New(), &eventMux) |