aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/main.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-07-01 06:52:44 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-01 06:52:44 +0800
commit29ab1fa8a50db8aa16c5d707f1cab7dc201a4053 (patch)
tree1339dbd873de83167526adfa4333225ad8aa7725 /cmd/geth/main.go
parentbe935bff84d54cd7a7f4074e2326d62f664ba4e3 (diff)
downloaddexon-29ab1fa8a50db8aa16c5d707f1cab7dc201a4053.tar
dexon-29ab1fa8a50db8aa16c5d707f1cab7dc201a4053.tar.gz
dexon-29ab1fa8a50db8aa16c5d707f1cab7dc201a4053.tar.bz2
dexon-29ab1fa8a50db8aa16c5d707f1cab7dc201a4053.tar.lz
dexon-29ab1fa8a50db8aa16c5d707f1cab7dc201a4053.tar.xz
dexon-29ab1fa8a50db8aa16c5d707f1cab7dc201a4053.tar.zst
dexon-29ab1fa8a50db8aa16c5d707f1cab7dc201a4053.zip
core, cmd/geth: recover by number
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r--cmd/geth/main.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index c46343a60..a7d3a73ef 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -39,6 +39,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/comms"
@@ -68,6 +69,15 @@ func init() {
app.Action = run
app.HideVersion = true // we have a command to print the version
app.Commands = []cli.Command{
+ {
+ Action: blockRecovery,
+ Name: "recover",
+ Usage: "attempts to recover a corrupted database by setting a new block head by number",
+ Description: `
+The recover commands will attempt to read out the last
+block based on that.
+`,
+ },
blocktestCommand,
importCommand,
exportCommand,
@@ -439,6 +449,20 @@ func unlockAccount(ctx *cli.Context, am *accounts.Manager, account string) (pass
return
}
+func blockRecovery(ctx *cli.Context) {
+ num := ctx.Args().First()
+ if len(ctx.Args()) < 1 {
+ glog.Fatal("recover requires block number")
+ }
+
+ cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx)
+ ethereum, err := eth.New(cfg)
+ if err != nil {
+ utils.Fatalf("%v", err)
+ }
+ ethereum.ChainManager().Recover(common.String2Big(num).Uint64())
+}
+
func startEth(ctx *cli.Context, eth *eth.Ethereum) {
// Start Ethereum itself