diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-26 18:16:01 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-26 19:06:01 +0800 |
commit | 49ded3aa7752148ebfbacd4e6ff5f46dc9376f89 (patch) | |
tree | ebde269fc7a836b67eb8d7a2a95a90297d8c2435 /xeth | |
parent | 5ab0eaa06d2f5879b9b22778988410bd0c73dcc0 (diff) | |
parent | 9884eed0cf7c95074fd5b3d5f0f592a423810a8a (diff) | |
download | go-tangerine-49ded3aa7752148ebfbacd4e6ff5f46dc9376f89.tar.gz go-tangerine-49ded3aa7752148ebfbacd4e6ff5f46dc9376f89.tar.zst go-tangerine-49ded3aa7752148ebfbacd4e6ff5f46dc9376f89.zip |
Merge branch 'develop' of github.com-obscure:ethereum/go-ethereum into develop
Conflicts:
accounts/account_manager.go
Diffstat (limited to 'xeth')
-rw-r--r-- | xeth/state.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/xeth/state.go b/xeth/state.go new file mode 100644 index 000000000..e2562613c --- /dev/null +++ b/xeth/state.go @@ -0,0 +1,33 @@ +package xeth + +import "github.com/ethereum/go-ethereum/state" + +type State struct { + xeth *XEth + state *state.StateDB +} + +func NewState(xeth *XEth, statedb *state.StateDB) *State { + return &State{xeth, statedb} +} + +func (self *State) State() *state.StateDB { + return self.state +} + +func (self *State) Get(addr string) *Object { + return &Object{self.state.GetStateObject(fromHex(addr))} +} + +func (self *State) SafeGet(addr string) *Object { + return &Object{self.safeGet(addr)} +} + +func (self *State) safeGet(addr string) *state.StateObject { + object := self.state.GetStateObject(fromHex(addr)) + if object == nil { + object = state.NewStateObject(fromHex(addr), self.xeth.eth.Db()) + } + + return object +} |