aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-25 23:20:26 +0800
committerzelig <viktor.tron@gmail.com>2014-06-25 23:20:26 +0800
commit08de13a57b4a59fc4a8ccf9e707ede57cc380a0c (patch)
tree94bd0dc4887284c6e0ae57a7b40825dae52eee0e /utils
parent6f09a3e8200ba2eeeeb296141d6644d04078a9c4 (diff)
parent9654b809120d1cc3c53ffe268fe47869ef0dc0a8 (diff)
downloaddexon-08de13a57b4a59fc4a8ccf9e707ede57cc380a0c.tar
dexon-08de13a57b4a59fc4a8ccf9e707ede57cc380a0c.tar.gz
dexon-08de13a57b4a59fc4a8ccf9e707ede57cc380a0c.tar.bz2
dexon-08de13a57b4a59fc4a8ccf9e707ede57cc380a0c.tar.lz
dexon-08de13a57b4a59fc4a8ccf9e707ede57cc380a0c.tar.xz
dexon-08de13a57b4a59fc4a8ccf9e707ede57cc380a0c.tar.zst
dexon-08de13a57b4a59fc4a8ccf9e707ede57cc380a0c.zip
merge upstream
Diffstat (limited to 'utils')
-rw-r--r--utils/cmd.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/utils/cmd.go b/utils/cmd.go
index 8bc9c63fa..34716b94a 100644
--- a/utils/cmd.go
+++ b/utils/cmd.go
@@ -219,3 +219,21 @@ func StopMining(ethereum *eth.Ethereum) bool {
}
return false
}
+
+// Replay block
+func BlockDo(ethereum *eth.Ethereum, hash []byte) error {
+ block := ethereum.BlockChain().GetBlock(hash)
+ if block == nil {
+ return fmt.Errorf("unknown block %x", hash)
+ }
+
+ parent := ethereum.BlockChain().GetBlock(block.PrevHash)
+
+ _, err := ethereum.StateManager().ApplyDiff(parent.State(), parent, block)
+ if err != nil {
+ return err
+ }
+
+ return nil
+
+}