diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-09 02:33:28 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-09 02:33:28 +0800 |
commit | 9e91579105e94395a108d43ec3ac0ae0e0f139c5 (patch) | |
tree | 65db0dbb984815d774d74100ddaed0e4e2eab73e /cmd | |
parent | bba4dcb72f216db531f97474ef636790cc82f318 (diff) | |
parent | 2547c9c9b70a66f11626cb199f7d288ab1985259 (diff) | |
download | go-tangerine-9e91579105e94395a108d43ec3ac0ae0e0f139c5.tar go-tangerine-9e91579105e94395a108d43ec3ac0ae0e0f139c5.tar.gz go-tangerine-9e91579105e94395a108d43ec3ac0ae0e0f139c5.tar.bz2 go-tangerine-9e91579105e94395a108d43ec3ac0ae0e0f139c5.tar.lz go-tangerine-9e91579105e94395a108d43ec3ac0ae0e0f139c5.tar.xz go-tangerine-9e91579105e94395a108d43ec3ac0ae0e0f139c5.tar.zst go-tangerine-9e91579105e94395a108d43ec3ac0ae0e0f139c5.zip |
Merge pull request #1885 from karalabe/olympic-fix
cmd: properly initialize Olympic for all subcommands
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/main.go | 4 | ||||
-rw-r--r-- | cmd/utils/cmd.go | 13 | ||||
-rw-r--r-- | cmd/utils/flags.go | 17 |
3 files changed, 17 insertions, 17 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 1889cb2f2..2d2c38ce8 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -340,6 +340,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso } app.Before = func(ctx *cli.Context) error { utils.SetupLogger(ctx) + utils.SetupNetwork(ctx) utils.SetupVM(ctx) utils.SetupEth(ctx) if ctx.GlobalBool(utils.PProfEanbledFlag.Name) { @@ -391,9 +392,6 @@ func makeDefaultExtra() []byte { func run(ctx *cli.Context) { utils.CheckLegalese(utils.MustDataDir(ctx)) - if ctx.GlobalBool(utils.OlympicFlag.Name) { - utils.InitOlympic() - } cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx) cfg.ExtraData = makeExtra(ctx) diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 5e4bfc937..1fbd96dc8 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -21,8 +21,6 @@ import ( "bufio" "fmt" "io" - "math" - "math/big" "os" "os/signal" "regexp" @@ -34,7 +32,6 @@ import ( "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" "github.com/peterh/liner" ) @@ -146,16 +143,6 @@ func StartEthereum(ethereum *eth.Ethereum) { }() } -func InitOlympic() { - params.DurationLimit = big.NewInt(8) - params.GenesisGasLimit = big.NewInt(3141592) - params.MinGasLimit = big.NewInt(125000) - params.MaximumExtraDataSize = big.NewInt(1024) - NetworkIdFlag.Value = 0 - core.BlockReward = big.NewInt(1.5e+18) - core.ExpDiffPeriod = big.NewInt(math.MaxInt64) -} - func FormatTransactionData(data string) []byte { d := common.StringToByteFunc(data, func(s string) (ret []byte) { slice := regexp.MustCompile("\\n|\\s").Split(s, 1000000000) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index dea43bc5c..e2184003c 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -20,6 +20,7 @@ import ( "crypto/ecdsa" "fmt" "log" + "math" "math/big" "net" "net/http" @@ -42,6 +43,7 @@ import ( "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/p2p/nat" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc/api" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" @@ -488,6 +490,20 @@ func SetupLogger(ctx *cli.Context) { glog.SetLogDir(ctx.GlobalString(LogFileFlag.Name)) } +// SetupNetwork configures the system for either the main net or some test network. +func SetupNetwork(ctx *cli.Context) { + switch { + case ctx.GlobalBool(OlympicFlag.Name): + params.DurationLimit = big.NewInt(8) + params.GenesisGasLimit = big.NewInt(3141592) + params.MinGasLimit = big.NewInt(125000) + params.MaximumExtraDataSize = big.NewInt(1024) + NetworkIdFlag.Value = 0 + core.BlockReward = big.NewInt(1.5e+18) + core.ExpDiffPeriod = big.NewInt(math.MaxInt64) + } +} + // SetupVM configured the VM package's global settings func SetupVM(ctx *cli.Context) { vm.EnableJit = ctx.GlobalBool(VMEnableJitFlag.Name) @@ -517,7 +533,6 @@ func MakeChain(ctx *cli.Context) (chain *core.BlockChain, chainDb ethdb.Database Fatalf("Could not open database: %v", err) } if ctx.GlobalBool(OlympicFlag.Name) { - InitOlympic() _, err := core.WriteTestNetGenesisBlock(chainDb, 42) if err != nil { glog.Fatalln(err) |