cmd/ethereum: add makedag command for testing

This commit is contained in:
Felix Lange 2015-03-17 14:12:34 +01:00
parent 3ea99f989f
commit b422835a59
1 changed files with 21 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import (
"time" "time"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "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.HideVersion = true // we have a command to print the version
app.Commands = []cli.Command{ app.Commands = []cli.Command{
blocktestCmd, 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, Action: version,
Name: "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) { func version(c *cli.Context) {
fmt.Printf(`%v fmt.Printf(`%v
Version: %v Version: %v