aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-06 00:57:03 +0800
committerobscuren <geffobscura@gmail.com>2015-04-06 00:59:18 +0800
commit9c55576c7b415954773c062d404a736741fb9794 (patch)
tree5c79551e6ad55d88c02fbe3374ebc9738b863f8d /cmd
parent3040296beb3a8ca991b738a83df0af7bddde2ac6 (diff)
downloadgo-tangerine-9c55576c7b415954773c062d404a736741fb9794.tar
go-tangerine-9c55576c7b415954773c062d404a736741fb9794.tar.gz
go-tangerine-9c55576c7b415954773c062d404a736741fb9794.tar.bz2
go-tangerine-9c55576c7b415954773c062d404a736741fb9794.tar.lz
go-tangerine-9c55576c7b415954773c062d404a736741fb9794.tar.xz
go-tangerine-9c55576c7b415954773c062d404a736741fb9794.tar.zst
go-tangerine-9c55576c7b415954773c062d404a736741fb9794.zip
Block header changed & console miner control
* miner control moved to `admin.miner` * miner option to set extra data * block extra now bytes
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/admin.go27
1 files changed, 24 insertions, 3 deletions
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go
index 1515cd6ac..5f1cb8c96 100644
--- a/cmd/geth/admin.go
+++ b/cmd/geth/admin.go
@@ -26,8 +26,6 @@ func (js *jsre) adminBindings() {
admin := t.Object()
admin.Set("suggestPeer", js.suggestPeer)
admin.Set("startRPC", js.startRPC)
- admin.Set("startMining", js.startMining)
- admin.Set("stopMining", js.stopMining)
admin.Set("nodeInfo", js.nodeInfo)
admin.Set("peers", js.peers)
admin.Set("newAccount", js.newAccount)
@@ -37,7 +35,30 @@ func (js *jsre) adminBindings() {
admin.Set("dumpBlock", js.dumpBlock)
admin.Set("verbosity", js.verbosity)
admin.Set("backtrace", js.backtrace)
- admin.Set("hashrate", js.hashrate)
+
+ admin.Set("miner", struct{}{})
+ t, _ = admin.Get("miner")
+ miner := t.Object()
+ miner.Set("start", js.startMining)
+ miner.Set("stop", js.stopMining)
+ miner.Set("hashrate", js.hashrate)
+ miner.Set("setExtra", js.setExtra)
+}
+
+func (js *jsre) setExtra(call otto.FunctionCall) otto.Value {
+ extra, err := call.Argument(0).ToString()
+ if err != nil {
+ fmt.Println(err)
+ return otto.UndefinedValue()
+ }
+
+ if len(extra) > 1024 {
+ fmt.Println("error: cannot exceed 1024 bytes")
+ return otto.UndefinedValue()
+ }
+
+ js.ethereum.Miner().SetExtra([]byte(extra))
+ return otto.UndefinedValue()
}
func (js *jsre) hashrate(otto.FunctionCall) otto.Value {