aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
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
+
+}