aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-04-02 17:40:25 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-04-02 17:40:25 +0800
commit96c7c39ae4a031a508b0470ff2b1a95f0f3f9e51 (patch)
tree394b3366a84ed3460233848849e84a96025fb2d4 /cmd/utils
parentfb578f4550a08617485d9146876489d1f3bb1b52 (diff)
parentcf842b3fe5ad497ef8dfd24c9179bc2fadbc707f (diff)
downloadgo-tangerine-96c7c39ae4a031a508b0470ff2b1a95f0f3f9e51.tar
go-tangerine-96c7c39ae4a031a508b0470ff2b1a95f0f3f9e51.tar.gz
go-tangerine-96c7c39ae4a031a508b0470ff2b1a95f0f3f9e51.tar.bz2
go-tangerine-96c7c39ae4a031a508b0470ff2b1a95f0f3f9e51.tar.lz
go-tangerine-96c7c39ae4a031a508b0470ff2b1a95f0f3f9e51.tar.xz
go-tangerine-96c7c39ae4a031a508b0470ff2b1a95f0f3f9e51.tar.zst
go-tangerine-96c7c39ae4a031a508b0470ff2b1a95f0f3f9e51.zip
Merge pull request #2409 from fjl/geth-fixup-init
cmd/geth: fix startup with empty database
Diffstat (limited to 'cmd/utils')
-rw-r--r--cmd/utils/flags.go27
1 files changed, 13 insertions, 14 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 3f54b40ca..5c0c3c614 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -772,23 +772,22 @@ func MustMakeChainConfig(ctx *cli.Context) *core.ChainConfig {
)
defer db.Close()
- chainConfig, err := core.GetChainConfig(db, genesis.Hash())
- if err != nil {
- if err != core.ChainConfigNotFoundErr {
+ if genesis != nil {
+ // Exsting genesis block, use stored config if available.
+ storedConfig, err := core.GetChainConfig(db, genesis.Hash())
+ if err == nil {
+ return storedConfig
+ } else if err != core.ChainConfigNotFoundErr {
Fatalf("Could not make chain configuration: %v", err)
}
- var homesteadBlockNo *big.Int
- if ctx.GlobalBool(TestNetFlag.Name) {
- homesteadBlockNo = params.TestNetHomesteadBlock
- } else {
- homesteadBlockNo = params.MainNetHomesteadBlock
- }
-
- chainConfig = &core.ChainConfig{
- HomesteadBlock: homesteadBlockNo,
- }
}
- return chainConfig
+ var homesteadBlockNo *big.Int
+ if ctx.GlobalBool(TestNetFlag.Name) {
+ homesteadBlockNo = params.TestNetHomesteadBlock
+ } else {
+ homesteadBlockNo = params.MainNetHomesteadBlock
+ }
+ return &core.ChainConfig{HomesteadBlock: homesteadBlockNo}
}
// MakeChainDatabase open an LevelDB using the flags passed to the client and will hard crash if it fails.