From b7d93500f13e3054c81196273ebf676ad8ecb5ba Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Mon, 6 Mar 2017 17:20:25 +0200 Subject: all: finish integrating Go ethash, delete C++ vendor --- cmd/geth/main.go | 2 +- cmd/geth/misccmd.go | 4 ++-- cmd/geth/usage.go | 2 +- cmd/utils/flags.go | 15 ++++++++------- 4 files changed, 12 insertions(+), 11 deletions(-) (limited to 'cmd') diff --git a/cmd/geth/main.go b/cmd/geth/main.go index bf5e81d45..cc6d3ac6a 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -95,6 +95,7 @@ func init() { utils.EthashCachesInMemoryFlag, utils.EthashCachesOnDiskFlag, utils.EthashDatasetDirFlag, + utils.EthashDatasetsInMemoryFlag, utils.EthashDatasetsOnDiskFlag, utils.FastSyncFlag, utils.LightModeFlag, @@ -111,7 +112,6 @@ func init() { utils.GasPriceFlag, utils.MinerThreadsFlag, utils.MiningEnabledFlag, - utils.AutoDAGFlag, utils.TargetGasLimitFlag, utils.NATFlag, utils.NoDiscoverFlag, 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 34910daa5..74768f507 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -84,6 +84,7 @@ var AppHelpFlagGroups = []flagGroup{ utils.EthashCachesInMemoryFlag, utils.EthashCachesOnDiskFlag, utils.EthashDatasetDirFlag, + utils.EthashDatasetsInMemoryFlag, utils.EthashDatasetsOnDiskFlag, }, }, @@ -141,7 +142,6 @@ var AppHelpFlagGroups = []flagGroup{ Flags: []cli.Flag{ utils.MiningEnabledFlag, utils.MinerThreadsFlag, - utils.AutoDAGFlag, utils.EtherbaseFlag, utils.TargetGasLimitFlag, utils.GasPriceFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index b92be8464..38c90d801 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -132,9 +132,14 @@ var ( Name: "ethash.dagdir", Usage: "Directory to store the ethash mining DAGs (default = inside home folder)", } + EthashDatasetsInMemoryFlag = cli.IntFlag{ + Name: "ethash.dagsinmem", + Usage: "Number of recent ethash mining DAGs to keep in memory (1+GB each)", + Value: 1, + } EthashDatasetsOnDiskFlag = cli.IntFlag{ Name: "ethash.dagsondisk", - Usage: "Number of ethash mining DAGs to keep on disk (1+GB each)", + Usage: "Number of recent ethash mining DAGs to keep on disk (1+GB each)", Value: 2, } NetworkIdFlag = cli.IntFlag{ @@ -207,10 +212,6 @@ var ( Usage: "Target gas limit sets the artificial target gas floor for the blocks to mine", Value: params.GenesisGasLimit.Uint64(), } - AutoDAGFlag = cli.BoolFlag{ - Name: "autodag", - Usage: "Enable automatic DAG pregeneration", - } EtherbaseFlag = cli.StringFlag{ Name: "etherbase", Usage: "Public address for block mining rewards (default = first account created)", @@ -809,8 +810,8 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) { EthashCachesInMem: ctx.GlobalInt(EthashCachesInMemoryFlag.Name), EthashCachesOnDisk: ctx.GlobalInt(EthashCachesOnDiskFlag.Name), EthashDatasetDir: MakeEthashDatasetDir(ctx), + EthashDatasetsInMem: ctx.GlobalInt(EthashDatasetsInMemoryFlag.Name), EthashDatasetsOnDisk: ctx.GlobalInt(EthashDatasetsOnDiskFlag.Name), - AutoDAG: ctx.GlobalBool(AutoDAGFlag.Name) || ctx.GlobalBool(MiningEnabledFlag.Name), EnablePreimageRecording: ctx.GlobalBool(VMEnableDebugFlag.Name), } @@ -982,7 +983,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai seal := pow.PoW(pow.FakePow{}) if !ctx.GlobalBool(FakePoWFlag.Name) { - seal = pow.NewFullEthash("", 1, 0, "", 0) + seal = pow.NewFullEthash("", 1, 0, "", 1, 0) } chain, err = core.NewBlockChain(chainDb, chainConfig, seal, new(event.TypeMux), vm.Config{EnablePreimageRecording: ctx.GlobalBool(VMEnableDebugFlag.Name)}) if err != nil { -- cgit