diff options
author | zelig <viktor.tron@gmail.com> | 2014-06-25 23:20:26 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-06-25 23:20:26 +0800 |
commit | 08de13a57b4a59fc4a8ccf9e707ede57cc380a0c (patch) | |
tree | 94bd0dc4887284c6e0ae57a7b40825dae52eee0e /utils | |
parent | 6f09a3e8200ba2eeeeb296141d6644d04078a9c4 (diff) | |
parent | 9654b809120d1cc3c53ffe268fe47869ef0dc0a8 (diff) | |
download | dexon-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.go | 18 |
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 + +} |