diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-27 03:21:41 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-27 03:21:41 +0800 |
commit | 76f6d75ef867e754264834fc7171d1a12f24c5bb (patch) | |
tree | a9531d9e14c15abd72625a98a21a9b988dc32319 /xeth/xeth.go | |
parent | b2a225a52e45315f3ec90e11707fefa6059d13f5 (diff) | |
parent | fa7deb10f636d89f668249b78792f8cc48146ee8 (diff) | |
download | dexon-76f6d75ef867e754264834fc7171d1a12f24c5bb.tar dexon-76f6d75ef867e754264834fc7171d1a12f24c5bb.tar.gz dexon-76f6d75ef867e754264834fc7171d1a12f24c5bb.tar.bz2 dexon-76f6d75ef867e754264834fc7171d1a12f24c5bb.tar.lz dexon-76f6d75ef867e754264834fc7171d1a12f24c5bb.tar.xz dexon-76f6d75ef867e754264834fc7171d1a12f24c5bb.tar.zst dexon-76f6d75ef867e754264834fc7171d1a12f24c5bb.zip |
Merge branch 'master' into hotfix/0.8.5-2
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r-- | xeth/xeth.go | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go index 2985ce982..d4c188fec 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -17,6 +17,7 @@ import ( "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/whisper" ) @@ -54,13 +55,26 @@ func New(eth Backend) *XEth { whisper: NewWhisper(eth.Whisper()), miner: eth.Miner(), } - xeth.state = NewState(xeth) + xeth.state = NewState(xeth, xeth.chainManager.TransState()) return xeth } -func (self *XEth) Backend() Backend { return self.eth } -func (self *XEth) State() *State { return self.state } +func (self *XEth) Backend() Backend { return self.eth } +func (self *XEth) UseState(statedb *state.StateDB) *XEth { + xeth := &XEth{ + eth: self.eth, + blockProcessor: self.blockProcessor, + chainManager: self.chainManager, + whisper: self.whisper, + miner: self.miner, + } + + xeth.state = NewState(xeth, statedb) + return xeth +} +func (self *XEth) State() *State { return self.state } + func (self *XEth) Whisper() *Whisper { return self.whisper } func (self *XEth) Miner() *miner.Miner { return self.miner } @@ -229,7 +243,7 @@ func (self *XEth) Call(toStr, valueStr, gasStr, gasPriceStr, dataStr string) (st } var ( - statedb = self.chainManager.TransState() + statedb = self.State().State() //self.chainManager.TransState() key = self.eth.KeyManager().KeyPair() from = statedb.GetOrNewStateObject(key.Address()) block = self.chainManager.CurrentBlock() |