From d43adfab485c88658a41077ead95329431b10c40 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Wed, 3 Jun 2015 17:02:59 +0200 Subject: [PATCH] added debug api --- cmd/console/admin.go | 69 +------------------------------------------ rpc/api/miner_args.go | 8 ++--- 2 files changed, 5 insertions(+), 72 deletions(-) diff --git a/cmd/console/admin.go b/cmd/console/admin.go index 46a4b349a8..e0d707f3f1 100644 --- a/cmd/console/admin.go +++ b/cmd/console/admin.go @@ -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) } diff --git a/rpc/api/miner_args.go b/rpc/api/miner_args.go index b5fc01ae47..f240e33fde 100644 --- a/rpc/api/miner_args.go +++ b/rpc/api/miner_args.go @@ -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 {