diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-11 00:14:31 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-03-11 00:14:31 +0800 |
commit | 269cfbb8ace76ddc1f50dbd5b218c499308c8a5c (patch) | |
tree | c2e9e274c64f431f03b9a6b8b3de22585c016027 /cmd/ethereum/main.go | |
parent | 972e2c1e31067a9bab77228c19348b66964ce643 (diff) | |
parent | 0542df941f57a75fa7b699089db1d9ae40e4ff71 (diff) | |
download | go-tangerine-269cfbb8ace76ddc1f50dbd5b218c499308c8a5c.tar.gz go-tangerine-269cfbb8ace76ddc1f50dbd5b218c499308c8a5c.tar.zst go-tangerine-269cfbb8ace76ddc1f50dbd5b218c499308c8a5c.zip |
Merge branch origin/develop into accounts-integration
Conflicts:
cmd/blocktest/main.go
cmd/mist/debugger.go
cmd/utils/cmd.go
Diffstat (limited to 'cmd/ethereum/main.go')
-rw-r--r-- | cmd/ethereum/main.go | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index ed17fcc1f..7b912cf6e 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -105,6 +105,11 @@ runtime will execute the file and exit. Name: "import", Usage: `import a blockchain file`, }, + { + Action: exportchain, + Name: "export", + Usage: `export blockchain into file`, + }, } app.Flags = []cli.Flag{ utils.BootnodesFlag, @@ -232,25 +237,39 @@ func importchain(ctx *cli.Context) { if len(ctx.Args()) != 1 { utils.Fatalf("This command requires an argument.") } - chain, _, _ := utils.GetChain(ctx) + chainmgr, _, _ := utils.GetChain(ctx) start := time.Now() - err := utils.ImportChain(chain, ctx.Args().First()) + err := utils.ImportChain(chainmgr, ctx.Args().First()) if err != nil { utils.Fatalf("Import error: %v\n", err) } - fmt.Printf("Import done in", time.Since(start)) + fmt.Printf("Import done in %v", time.Since(start)) + return +} + +func exportchain(ctx *cli.Context) { + if len(ctx.Args()) != 1 { + utils.Fatalf("This command requires an argument.") + } + chainmgr, _, _ := utils.GetChain(ctx) + start := time.Now() + err := utils.ExportChain(chainmgr, ctx.Args().First()) + if err != nil { + utils.Fatalf("Export error: %v\n", err) + } + fmt.Printf("Export done in %v", time.Since(start)) return } func dump(ctx *cli.Context) { - chain, _, stateDb := utils.GetChain(ctx) + chainmgr, _, stateDb := utils.GetChain(ctx) for _, arg := range ctx.Args() { var block *types.Block if hashish(arg) { - block = chain.GetBlock(ethutil.Hex2Bytes(arg)) + block = chainmgr.GetBlock(ethutil.Hex2Bytes(arg)) } else { num, _ := strconv.Atoi(arg) - block = chain.GetBlockByNumber(uint64(num)) + block = chainmgr.GetBlockByNumber(uint64(num)) } if block == nil { fmt.Println("{}") @@ -264,13 +283,15 @@ func dump(ctx *cli.Context) { } func version(c *cli.Context) { - fmt.Printf(`%v %v -PV=%d -GOOS=%s -GO=%s + fmt.Printf(`%v +Version: %v +Protocol Version: %d +Network Id: %d +GO: %s +OS: %s GOPATH=%s GOROOT=%s -`, ClientIdentifier, Version, eth.ProtocolVersion, runtime.GOOS, runtime.Version(), os.Getenv("GOPATH"), runtime.GOROOT()) +`, ClientIdentifier, Version, eth.ProtocolVersion, eth.NetworkId, runtime.Version(), runtime.GOOS, os.Getenv("GOPATH"), runtime.GOROOT()) } // hashish returns true for strings that look like hashes. |