aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-20 22:03:19 +0800
committerobscuren <geffobscura@gmail.com>2015-04-20 22:03:19 +0800
commit76025cc4245f0abc0749f4d1e433be865107bf24 (patch)
tree4fd8275bae465760d0fbfaea073d2aa397ac4400
parent72d065d49102dd07c929d1e147186604c5e4ab05 (diff)
downloaddexon-76025cc4245f0abc0749f4d1e433be865107bf24.tar
dexon-76025cc4245f0abc0749f4d1e433be865107bf24.tar.gz
dexon-76025cc4245f0abc0749f4d1e433be865107bf24.tar.bz2
dexon-76025cc4245f0abc0749f4d1e433be865107bf24.tar.lz
dexon-76025cc4245f0abc0749f4d1e433be865107bf24.tar.xz
dexon-76025cc4245f0abc0749f4d1e433be865107bf24.tar.zst
dexon-76025cc4245f0abc0749f4d1e433be865107bf24.zip
geth: added a `admin.debug.block` command which reprocess the block
-rw-r--r--cmd/geth/admin.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go
index 1cd0aa2a9..defbb43ec 100644
--- a/cmd/geth/admin.go
+++ b/cmd/geth/admin.go
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
@@ -52,6 +53,7 @@ func (js *jsre) adminBindings() {
debug.Set("dumpBlock", js.dumpBlock)
debug.Set("getBlockRlp", js.getBlockRlp)
debug.Set("setHead", js.setHead)
+ debug.Set("block", js.debugBlock)
}
func (js *jsre) getBlock(call otto.FunctionCall) (*types.Block, error) {
@@ -72,6 +74,29 @@ func (js *jsre) getBlock(call otto.FunctionCall) (*types.Block, error) {
return nil, errors.New("requires block number or block hash as argument")
}
+func (js *jsre) debugBlock(call otto.FunctionCall) otto.Value {
+ block, err := js.getBlock(call)
+ if err != nil {
+ fmt.Println(err)
+ return otto.UndefinedValue()
+ }
+
+ if block == nil {
+ fmt.Println("block not found")
+ return otto.UndefinedValue()
+ }
+
+ old := vm.Debug
+ vm.Debug = true
+ _, err = js.ethereum.BlockProcessor().RetryProcess(block)
+ if err != nil {
+ glog.Infoln(err)
+ }
+ vm.Debug = old
+
+ return otto.UndefinedValue()
+}
+
func (js *jsre) setHead(call otto.FunctionCall) otto.Value {
block, err := js.getBlock(call)
if err != nil {