diff options
author | Felix Lange <fjl@twurst.com> | 2015-08-27 06:03:59 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-08-27 06:03:59 +0800 |
commit | 6ec13e7e2bab1ebdb580819a48629055bbbb5fb3 (patch) | |
tree | cd23c3deac1a41b34a5157c1f7c5361ca56b4137 /cmd | |
parent | 79b644c7a35bbc835b7e78ddf8a31c37e69b0784 (diff) | |
parent | 17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d (diff) | |
download | go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.gz go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.bz2 go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.lz go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.xz go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.zst go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.zip |
Merge pull request #1701 from karalabe/eth62-sync-rebase
eth: implement eth/62 synchronization logic
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/main.go | 2 | ||||
-rw-r--r-- | cmd/geth/monitorcmd.go | 2 | ||||
-rw-r--r-- | cmd/utils/flags.go | 17 |
3 files changed, 20 insertions, 1 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index ff556c984..dc7e19c61 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -283,6 +283,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso utils.DataDirFlag, utils.BlockchainVersionFlag, utils.OlympicFlag, + utils.EthVersionFlag, utils.CacheFlag, utils.JSpathFlag, utils.ListenPortFlag, @@ -333,6 +334,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso app.Before = func(ctx *cli.Context) error { utils.SetupLogger(ctx) utils.SetupVM(ctx) + utils.SetupEth(ctx) if ctx.GlobalBool(utils.PProfEanbledFlag.Name) { utils.StartPProf(ctx) } diff --git a/cmd/geth/monitorcmd.go b/cmd/geth/monitorcmd.go index a7c099532..a45d29b8f 100644 --- a/cmd/geth/monitorcmd.go +++ b/cmd/geth/monitorcmd.go @@ -289,7 +289,7 @@ func updateChart(metric string, data []float64, base *int, chart *termui.LineCha } } unit, scale := 0, 1.0 - for high >= 1000 { + for high >= 1000 && unit+1 < len(dataUnits) { high, unit, scale = high/1000, unit+1, scale*1000 } // If the unit changes, re-create the chart (hack to set max height...) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index af2929d10..80805ca22 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -138,6 +138,11 @@ var ( Name: "olympic", Usage: "Use olympic style protocol", } + EthVersionFlag = cli.IntFlag{ + Name: "eth", + Value: 62, + Usage: "Highest eth protocol to advertise (temporary, dev option)", + } // miner settings MinerThreadsFlag = cli.IntFlag{ @@ -459,6 +464,18 @@ func SetupVM(ctx *cli.Context) { vm.SetJITCacheSize(ctx.GlobalInt(VMJitCacheFlag.Name)) } +// SetupEth configures the eth packages global settings +func SetupEth(ctx *cli.Context) { + version := ctx.GlobalInt(EthVersionFlag.Name) + for len(eth.ProtocolVersions) > 0 && eth.ProtocolVersions[0] > uint(version) { + eth.ProtocolVersions = eth.ProtocolVersions[1:] + eth.ProtocolLengths = eth.ProtocolLengths[1:] + } + if len(eth.ProtocolVersions) == 0 { + Fatalf("No valid eth protocols remaining") + } +} + // MakeChain creates a chain manager from set command line flags. func MakeChain(ctx *cli.Context) (chain *core.ChainManager, chainDb common.Database) { datadir := ctx.GlobalString(DataDirFlag.Name) |