aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/admin.go26
-rw-r--r--cmd/geth/main.go6
-rw-r--r--cmd/utils/flags.go9
3 files changed, 39 insertions, 2 deletions
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go
index f8c717187..2ac155e33 100644
--- a/cmd/geth/admin.go
+++ b/cmd/geth/admin.go
@@ -48,6 +48,32 @@ func (js *jsre) adminBindings() {
debug := t.Object()
debug.Set("printBlock", js.printBlock)
debug.Set("dumpBlock", js.dumpBlock)
+ debug.Set("getBlockRlp", js.getBlockRlp)
+}
+
+func (js *jsre) getBlockRlp(call otto.FunctionCall) otto.Value {
+ var block *types.Block
+ if len(call.ArgumentList) > 0 {
+ if call.Argument(0).IsNumber() {
+ num, _ := call.Argument(0).ToInteger()
+ block = js.ethereum.ChainManager().GetBlockByNumber(uint64(num))
+ } else if call.Argument(0).IsString() {
+ hash, _ := call.Argument(0).ToString()
+ block = js.ethereum.ChainManager().GetBlock(common.HexToHash(hash))
+ } else {
+ fmt.Println("invalid argument for dump. Either hex string or number")
+ }
+
+ } else {
+ block = js.ethereum.ChainManager().CurrentBlock()
+ }
+ if block == nil {
+ fmt.Println("block not found")
+ return otto.UndefinedValue()
+ }
+
+ encoded, _ := rlp.EncodeToBytes(block)
+ return js.re.ToVal(fmt.Sprintf("%x", encoded))
}
func (js *jsre) setExtra(call otto.FunctionCall) otto.Value {
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index e18b92a2e..dab167bbb 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -31,6 +31,8 @@ import (
"strconv"
"time"
+ "path"
+
"github.com/codegangsta/cli"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/accounts"
@@ -42,13 +44,12 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/logger"
"github.com/peterh/liner"
- "path"
)
import _ "net/http/pprof"
const (
ClientIdentifier = "Geth"
- Version = "0.9.9"
+ Version = "0.9.10"
)
var app = utils.NewApp(Version, "the go-ethereum command line interface")
@@ -217,6 +218,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
},
}
app.Flags = []cli.Flag{
+ utils.IdentityFlag,
utils.UnlockedAccountFlag,
utils.PasswordFileFlag,
utils.BootnodesFlag,
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 8141fae82..a1d9eedda 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -89,6 +89,10 @@ var (
Usage: "Blockchain version",
Value: core.BlockChainVersion,
}
+ IdentityFlag = cli.StringFlag{
+ Name: "identity",
+ Usage: "node name",
+ }
// miner settings
MinerThreadsFlag = cli.IntFlag{
@@ -242,6 +246,11 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
// Set the log dir
glog.SetLogDir(ctx.GlobalString(LogFileFlag.Name))
+ customName := ctx.GlobalString(IdentityFlag.Name)
+ if len(customName) > 0 {
+ clientID += "/" + customName
+ }
+
return &eth.Config{
Name: common.MakeName(clientID, version),
DataDir: ctx.GlobalString(DataDirFlag.Name),