diff options
Diffstat (limited to 'cmd/geth')
-rw-r--r-- | cmd/geth/chaincmd.go | 27 | ||||
-rw-r--r-- | cmd/geth/main.go | 8 | ||||
-rw-r--r-- | cmd/geth/misccmd.go | 4 | ||||
-rw-r--r-- | cmd/geth/usage.go | 12 |
4 files changed, 42 insertions, 9 deletions
diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 784692261..6ea474a9c 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -54,10 +54,13 @@ participating. Action: importChain, Name: "import", Usage: "Import a blockchain file", - ArgsUsage: "<filename>", + ArgsUsage: "<filename> (<filename 2> ... <filename N>) ", Category: "BLOCKCHAIN COMMANDS", Description: ` -TODO: Please write this +The import command imports blocks from an RLP-encoded form. The form can be one file +with several RLP-encoded blocks, or several files can be used. +If only one file is used, import error will result in failure. If several files are used, +processing will proceed even if an individual RLP-file import failure occurs. `, } exportCommand = cli.Command{ @@ -122,7 +125,7 @@ func initGenesis(ctx *cli.Context) error { } func importChain(ctx *cli.Context) error { - if len(ctx.Args()) != 1 { + if len(ctx.Args()) < 1 { utils.Fatalf("This command requires an argument.") } stack := makeFullNode(ctx) @@ -146,9 +149,19 @@ func importChain(ctx *cli.Context) error { }() // Import the chain start := time.Now() - if err := utils.ImportChain(chain, ctx.Args().First()); err != nil { - utils.Fatalf("Import error: %v", err) + + if len(ctx.Args()) == 1 { + if err := utils.ImportChain(chain, ctx.Args().First()); err != nil { + utils.Fatalf("Import error: %v", err) + } + } else { + for _, arg := range ctx.Args() { + if err := utils.ImportChain(chain, arg); err != nil { + log.Error("Import error", "file", arg, "err", err) + } + } } + fmt.Printf("Import done in %v.\n\n", time.Since(start)) // Output pre-compaction stats mostly to see the import trashing @@ -171,6 +184,10 @@ func importChain(ctx *cli.Context) error { fmt.Printf("Allocations: %.3f million\n", float64(mem.Mallocs)/1000000) fmt.Printf("GC pause: %v\n\n", time.Duration(mem.PauseTotalNs)) + if ctx.GlobalIsSet(utils.NoCompactionFlag.Name) { + return nil + } + // Compact the entire database to more accurately measure disk io and print the stats start = time.Now() fmt.Println("Compacting entire database...") diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 79893cc04..cc6d3ac6a 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -91,6 +91,12 @@ func init() { utils.BootnodesFlag, utils.DataDirFlag, utils.KeyStoreDirFlag, + utils.EthashCacheDirFlag, + utils.EthashCachesInMemoryFlag, + utils.EthashCachesOnDiskFlag, + utils.EthashDatasetDirFlag, + utils.EthashDatasetsInMemoryFlag, + utils.EthashDatasetsOnDiskFlag, utils.FastSyncFlag, utils.LightModeFlag, utils.LightServFlag, @@ -106,7 +112,6 @@ func init() { utils.GasPriceFlag, utils.MinerThreadsFlag, utils.MiningEnabledFlag, - utils.AutoDAGFlag, utils.TargetGasLimitFlag, utils.NATFlag, utils.NoDiscoverFlag, @@ -140,6 +145,7 @@ func init() { utils.EthStatsURLFlag, utils.MetricsEnabledFlag, utils.FakePoWFlag, + utils.NoCompactionFlag, utils.SolcPathFlag, utils.GpoMinGasPriceFlag, utils.GpoMaxGasPriceFlag, diff --git a/cmd/geth/misccmd.go b/cmd/geth/misccmd.go index 077f1ad11..073c36beb 100644 --- a/cmd/geth/misccmd.go +++ b/cmd/geth/misccmd.go @@ -25,10 +25,10 @@ import ( "strconv" "strings" - "github.com/ethereum/ethash" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/pow" "gopkg.in/urfave/cli.v1" ) @@ -87,7 +87,7 @@ func makedag(ctx *cli.Context) error { utils.Fatalf("Can't find dir") } fmt.Println("making DAG, this could take awhile...") - ethash.MakeDAG(blockNum, dir) + pow.MakeDataset(blockNum, dir) } default: wrongArgs() diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 9349857e9..74768f507 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -78,6 +78,17 @@ var AppHelpFlagGroups = []flagGroup{ }, }, { + Name: "ETHASH", + Flags: []cli.Flag{ + utils.EthashCacheDirFlag, + utils.EthashCachesInMemoryFlag, + utils.EthashCachesOnDiskFlag, + utils.EthashDatasetDirFlag, + utils.EthashDatasetsInMemoryFlag, + utils.EthashDatasetsOnDiskFlag, + }, + }, + { Name: "PERFORMANCE TUNING", Flags: []cli.Flag{ utils.CacheFlag, @@ -131,7 +142,6 @@ var AppHelpFlagGroups = []flagGroup{ Flags: []cli.Flag{ utils.MiningEnabledFlag, utils.MinerThreadsFlag, - utils.AutoDAGFlag, utils.EtherbaseFlag, utils.TargetGasLimitFlag, utils.GasPriceFlag, |