aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-23 17:25:14 +0800
committerobscuren <geffobscura@gmail.com>2014-06-23 17:25:14 +0800
commita4e26bf7c2c0cfc65be14ef98af695a0d663609f (patch)
tree016d6708baba175a1670986a76bdd984b7504a80 /ethereum.go
parent9350ecd36fe3a30bea4cfd60db9a53787d4d5852 (diff)
downloaddexon-a4e26bf7c2c0cfc65be14ef98af695a0d663609f.tar
dexon-a4e26bf7c2c0cfc65be14ef98af695a0d663609f.tar.gz
dexon-a4e26bf7c2c0cfc65be14ef98af695a0d663609f.tar.bz2
dexon-a4e26bf7c2c0cfc65be14ef98af695a0d663609f.tar.lz
dexon-a4e26bf7c2c0cfc65be14ef98af695a0d663609f.tar.xz
dexon-a4e26bf7c2c0cfc65be14ef98af695a0d663609f.tar.zst
dexon-a4e26bf7c2c0cfc65be14ef98af695a0d663609f.zip
Added Block do which replays the given block or error
Diffstat (limited to 'ethereum.go')
-rw-r--r--ethereum.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/ethereum.go b/ethereum.go
index a6cb78b1f..77a7c92c7 100644
--- a/ethereum.go
+++ b/ethereum.go
@@ -113,6 +113,24 @@ func New(caps Caps, usePnp bool) (*Ethereum, error) {
return ethereum, nil
}
+// Replay block
+func (self *Ethereum) BlockDo(hash []byte) error {
+ block := self.blockChain.GetBlock(hash)
+ if block == nil {
+ return fmt.Errorf("unknown block %x", hash)
+ }
+
+ parent := self.blockChain.GetBlock(block.PrevHash)
+
+ _, err := self.stateManager.ApplyDiff(parent.State(), parent, block)
+ if err != nil {
+ return err
+ }
+
+ return nil
+
+}
+
func (s *Ethereum) Reactor() *ethutil.ReactorEngine {
return s.reactor
}