aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-05-07 02:20:54 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-05-07 02:20:54 +0800
commit1f26a1b86319f9468395e0772b5ae8f02cce8ec8 (patch)
tree3aa5255e7d82f4161b26bc60425fa0b026516007 /cmd/geth
parentaa884c052ddf7c5e8f673972b34681982de1cd52 (diff)
parent054947def77bc2352f90f79206146c93dd5422d0 (diff)
downloadgo-tangerine-1f26a1b86319f9468395e0772b5ae8f02cce8ec8.tar
go-tangerine-1f26a1b86319f9468395e0772b5ae8f02cce8ec8.tar.gz
go-tangerine-1f26a1b86319f9468395e0772b5ae8f02cce8ec8.tar.bz2
go-tangerine-1f26a1b86319f9468395e0772b5ae8f02cce8ec8.tar.lz
go-tangerine-1f26a1b86319f9468395e0772b5ae8f02cce8ec8.tar.xz
go-tangerine-1f26a1b86319f9468395e0772b5ae8f02cce8ec8.tar.zst
go-tangerine-1f26a1b86319f9468395e0772b5ae8f02cce8ec8.zip
Merge pull request #859 from Gustav-Simonsson/ethash_reloaded
Ethash reloaded
Diffstat (limited to 'cmd/geth')
-rw-r--r--cmd/geth/main.go34
1 files changed, 28 insertions, 6 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index e00b139c0..f2497ccf4 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -27,8 +27,10 @@ import (
"io/ioutil"
"os"
"path"
+ "path/filepath"
"runtime"
"strconv"
+ "strings"
"time"
"github.com/codegangsta/cli"
@@ -601,12 +603,32 @@ func dump(ctx *cli.Context) {
}
func makedag(ctx *cli.Context) {
- chain, _, _ := utils.GetChain(ctx)
- pow := ethash.New(chain)
- fmt.Println("making cache")
- pow.UpdateCache(0, true)
- fmt.Println("making DAG")
- pow.UpdateDAG()
+ args := ctx.Args()
+ wrongArgs := func() {
+ utils.Fatalf(`Usage: geth makedag <block number> <outputdir>`)
+ }
+ switch {
+ case len(args) == 2:
+ blockNum, err := strconv.ParseUint(args[0], 0, 64)
+ dir := args[1]
+ if err != nil {
+ wrongArgs()
+ } else {
+ dir = filepath.Clean(dir)
+ // seems to require a trailing slash
+ if !strings.HasSuffix(dir, "/") {
+ dir = dir + "/"
+ }
+ _, err = ioutil.ReadDir(dir)
+ if err != nil {
+ utils.Fatalf("Can't find dir")
+ }
+ fmt.Println("making DAG, this could take awhile...")
+ ethash.MakeDAG(blockNum, dir)
+ }
+ default:
+ wrongArgs()
+ }
}
func version(c *cli.Context) {