Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/ethereum: add makedag command for testing #522

Merged
merged 1 commit into from
Mar 18, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cmd/ethereum/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand Down