From b422835a59ddcba02f8fee3c0933c7bf09d9663e Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 17 Mar 2015 14:12:34 +0100 Subject: [PATCH] cmd/ethereum: add makedag command for testing --- cmd/ethereum/main.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 3b952dd790..35b636c6ef 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -30,6 +30,7 @@ import ( "time" "github.com/codegangsta/cli" + "github.com/ethereum/ethash" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -54,6 +55,17 @@ func init() { app.HideVersion = true // we have a command to print the version app.Commands = []cli.Command{ blocktestCmd, + { + Action: makedag, + Name: "makedag", + Usage: "generate ethash dag (for testing)", + Description: ` +The makedag command generates an ethash DAG in /tmp/dag. + +This command exists to support the system testing project. +Regular users do not need to execute it. +`, + }, { Action: version, Name: "version", @@ -318,6 +330,15 @@ func dump(ctx *cli.Context) { } } +func makedag(ctx *cli.Context) { + chain, _, _ := utils.GetChain(ctx) + pow := ethash.New(chain) + fmt.Println("making cache") + pow.UpdateCache(true) + fmt.Println("making DAG") + pow.UpdateDAG() +} + func version(c *cli.Context) { fmt.Printf(`%v Version: %v