aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-05-27 06:11:54 +0800
committerobscuren <geffobscura@gmail.com>2015-05-27 07:38:41 +0800
commitb2f2806055c90f6956db6c89bfdc3df65b95d6b6 (patch)
tree6ac68bb08c8472f201d3e8e032609d5511f8c6fb /cmd
parent612f01400f59b0b4d0db9f9ceaa38f45805ea89e (diff)
downloaddexon-b2f2806055c90f6956db6c89bfdc3df65b95d6b6.tar
dexon-b2f2806055c90f6956db6c89bfdc3df65b95d6b6.tar.gz
dexon-b2f2806055c90f6956db6c89bfdc3df65b95d6b6.tar.bz2
dexon-b2f2806055c90f6956db6c89bfdc3df65b95d6b6.tar.lz
dexon-b2f2806055c90f6956db6c89bfdc3df65b95d6b6.tar.xz
dexon-b2f2806055c90f6956db6c89bfdc3df65b95d6b6.tar.zst
dexon-b2f2806055c90f6956db6c89bfdc3df65b95d6b6.zip
cmd/geth, core: Updated DB version & seedhash debug method
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/admin.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go
index 28786553c..8f9a009d7 100644
--- a/cmd/geth/admin.go
+++ b/cmd/geth/admin.go
@@ -88,6 +88,7 @@ func (js *jsre) adminBindings() {
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)
}
@@ -118,6 +119,27 @@ func (js *jsre) getBlock(call otto.FunctionCall) (*types.Block, error) {
return block, nil
}
+func (js *jsre) seedHash(call otto.FunctionCall) otto.Value {
+ if len(call.ArgumentList) > 0 {
+ if call.Argument(0).IsNumber() {
+ num, _ := call.Argument(0).ToInteger()
+ hash, err := ethash.GetSeedHash(uint64(num))
+ if err != nil {
+ fmt.Println(err)
+ return otto.UndefinedValue()
+ }
+ v, _ := call.Otto.ToValue(fmt.Sprintf("0x%x", hash))
+ return v
+ } else {
+ fmt.Println("arg not a number")
+ }
+ } else {
+ fmt.Println("requires number argument")
+ }
+
+ return otto.UndefinedValue()
+}
+
func (js *jsre) pendingTransactions(call otto.FunctionCall) otto.Value {
txs := js.ethereum.TxPool().GetTransactions()
@@ -220,10 +242,11 @@ func (js *jsre) debugBlock(call otto.FunctionCall) otto.Value {
vm.Debug = true
_, err = js.ethereum.BlockProcessor().RetryProcess(block)
if err != nil {
- glog.Infoln(err)
+ fmt.Println(err)
}
vm.Debug = old
+ fmt.Println("ok")
return otto.UndefinedValue()
}