aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/geth')
-rw-r--r--cmd/geth/blocktestcmd.go3
-rw-r--r--cmd/geth/chaincmd.go3
-rw-r--r--cmd/geth/js_test.go2
-rw-r--r--cmd/geth/main.go26
4 files changed, 25 insertions, 9 deletions
diff --git a/cmd/geth/blocktestcmd.go b/cmd/geth/blocktestcmd.go
index 4eff82e3d..a667cfd60 100644
--- a/cmd/geth/blocktestcmd.go
+++ b/cmd/geth/blocktestcmd.go
@@ -22,7 +22,6 @@ import (
"github.com/codegangsta/cli"
"github.com/ethereum/go-ethereum/cmd/utils"
- "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/tests"
@@ -103,7 +102,7 @@ func runBlockTest(ctx *cli.Context) {
func runOneBlockTest(ctx *cli.Context, test *tests.BlockTest) (*eth.Ethereum, error) {
cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx)
- cfg.NewDB = func(path string) (common.Database, error) { return ethdb.NewMemDatabase() }
+ cfg.NewDB = func(path string) (ethdb.Database, error) { return ethdb.NewMemDatabase() }
cfg.MaxPeers = 0 // disable network
cfg.Shh = false // disable whisper
cfg.NAT = nil // disable port mapping
diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go
index c42045918..c5bc4b66a 100644
--- a/cmd/geth/chaincmd.go
+++ b/cmd/geth/chaincmd.go
@@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/logger/glog"
)
@@ -191,7 +192,7 @@ func hashish(x string) bool {
return err != nil
}
-func closeAll(dbs ...common.Database) {
+func closeAll(dbs ...ethdb.Database) {
for _, db := range dbs {
db.Close()
}
diff --git a/cmd/geth/js_test.go b/cmd/geth/js_test.go
index 67c36dfe7..2fd5a531d 100644
--- a/cmd/geth/js_test.go
+++ b/cmd/geth/js_test.go
@@ -103,7 +103,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *eth
Name: "test",
SolcPath: testSolcPath,
PowTest: true,
- NewDB: func(path string) (common.Database, error) { return db, nil },
+ NewDB: func(path string) (ethdb.Database, error) { return db, nil },
}
if config != nil {
config(conf)
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index aacb588fe..b54d85c22 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -58,6 +58,11 @@ var (
gitCommit string // set via linker flagg
nodeNameVersion string
app *cli.App
+
+ ExtraDataFlag = cli.StringFlag{
+ Name: "extradata",
+ Usage: "Extra data for the miner",
+ }
)
func init() {
@@ -308,6 +313,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.IPCPathFlag,
utils.ExecFlag,
utils.WhisperEnabledFlag,
+ utils.DevModeFlag,
utils.VMDebugFlag,
utils.VMForceJitFlag,
utils.VMJitCacheFlag,
@@ -330,6 +336,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.GpobaseStepDownFlag,
utils.GpobaseStepUpFlag,
utils.GpobaseCorrectionFactorFlag,
+ ExtraDataFlag,
}
app.Before = func(ctx *cli.Context) error {
utils.SetupLogger(ctx)
@@ -353,6 +360,14 @@ func main() {
}
}
+// makeExtra resolves extradata for the miner from a flag or returns a default.
+func makeExtra(ctx *cli.Context) []byte {
+ if ctx.GlobalIsSet(ExtraDataFlag.Name) {
+ return []byte(ctx.GlobalString(ExtraDataFlag.Name))
+ }
+ return makeDefaultExtra()
+}
+
func makeDefaultExtra() []byte {
var clientInfo = struct {
Version uint
@@ -381,7 +396,7 @@ func run(ctx *cli.Context) {
}
cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx)
- cfg.ExtraData = makeDefaultExtra()
+ cfg.ExtraData = makeExtra(ctx)
ethereum, err := eth.New(cfg)
if err != nil {
@@ -429,6 +444,8 @@ func console(ctx *cli.Context) {
utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name))
cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx)
+ cfg.ExtraData = makeExtra(ctx)
+
ethereum, err := eth.New(cfg)
if err != nil {
utils.Fatalf("%v", err)
@@ -527,17 +544,16 @@ func blockRecovery(ctx *cli.Context) {
var block *types.Block
if arg[0] == '#' {
- block = core.GetBlockByNumber(blockDb, common.String2Big(arg[1:]).Uint64())
+ block = core.GetBlock(blockDb, core.GetCanonicalHash(blockDb, common.String2Big(arg[1:]).Uint64()))
} else {
- block = core.GetBlockByHash(blockDb, common.HexToHash(arg))
+ block = core.GetBlock(blockDb, common.HexToHash(arg))
}
if block == nil {
glog.Fatalln("block not found. Recovery failed")
}
- err = core.WriteHead(blockDb, block)
- if err != nil {
+ if err = core.WriteHeadBlockHash(blockDb, block.Hash()); err != nil {
glog.Fatalln("block write err", err)
}
glog.Infof("Recovery succesful. New HEAD %x\n", block.Hash())