added debug api

This commit is contained in:
Bas van Kervel 2015-06-03 17:02:59 +02:00
parent 719a23c6f6
commit d43adfab48
2 changed files with 5 additions and 72 deletions

View file

@ -5,72 +5,5 @@ node admin bindings
*/
func (js *jsre) adminBindings() {
js.re.Set("admin", struct{}{})
t, _ := js.re.Get("admin")
admin := t.Object()
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)
// miner.Set("setGasPrice", js.setGasPrice)
// miner.Set("startAutoDAG", js.startAutoDAG)
// miner.Set("stopAutoDAG", js.stopAutoDAG)
// miner.Set("makeDAG", js.makeDAG)
/*
ethO, _ := js.re.Get("eth")
eth := ethO.Object()
eth.Set("pendingTransactions", js.pendingTransactions)
eth.Set("resend", js.resend)
eth.Set("sign", js.sign)
js.re.Set("admin", struct{}{})
t, _ := js.re.Get("admin")
admin := t.Object()
admin.Set("addPeer", js.addPeer)
admin.Set("startRPC", js.startRPC)
admin.Set("stopRPC", js.stopRPC)
admin.Set("nodeInfo", js.nodeInfo)
admin.Set("peers", js.peers)
admin.Set("newAccount", js.newAccount)
admin.Set("unlock", js.unlock)
admin.Set("import", js.importChain)
admin.Set("export", js.exportChain)
admin.Set("verbosity", js.verbosity)
admin.Set("progress", js.downloadProgress)
admin.Set("setSolc", js.setSolc)
admin.Set("contractInfo", struct{}{})
t, _ = admin.Get("contractInfo")
cinfo := t.Object()
// newRegistry officially not documented temporary option
cinfo.Set("start", js.startNatSpec)
cinfo.Set("stop", js.stopNatSpec)
cinfo.Set("newRegistry", js.newRegistry)
cinfo.Set("get", js.getContractInfo)
cinfo.Set("register", js.register)
cinfo.Set("registerUrl", js.registerUrl)
// cinfo.Set("verify", js.verify)
admin.Set("debug", struct{}{})
t, _ = admin.Get("debug")
debug := t.Object()
js.re.Set("sleep", js.sleep)
debug.Set("backtrace", js.backtrace)
debug.Set("printBlock", js.printBlock)
debug.Set("dumpBlock", js.dumpBlock)
debug.Set("getBlockRlp", js.getBlockRlp)
debug.Set("setHead", js.setHead)
debug.Set("processBlock", js.debugBlock)
debug.Set("seedhash", js.seedHash)
// undocumented temporary
debug.Set("waitForBlocks", js.waitForBlocks)
*/
// load admin.js just as the eth api (web3)
}

View file

@ -1,9 +1,10 @@
package api
import (
"encoding/json"
"github.com/ethereum/go-ethereum/rpc/shared"
"math/big"
"fmt"
"github.com/ethereum/go-ethereum/rpc/shared"
)
type StartMinerArgs struct {
@ -11,7 +12,6 @@ type StartMinerArgs struct {
}
func (args *StartMinerArgs) UnmarshalJSON(b []byte) (err error) {
fmt.Printf("b=%s\n", string(b))
var obj []interface{}
if err := json.Unmarshal(b, &obj); err != nil {
return shared.NewDecodeParamError(err.Error())
@ -31,7 +31,7 @@ func (args *StartMinerArgs) UnmarshalJSON(b []byte) (err error) {
args.Threads = int(arg0.Int64())
}
return shared.NewValidationError("threads", "Must be in range [0...256]")
return shared.NewValidationError("threads", "must be in range [0...256]")
}
type SetExtraArgs struct {