aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-26 18:16:01 +0800
committerobscuren <geffobscura@gmail.com>2015-02-26 19:06:01 +0800
commit49ded3aa7752148ebfbacd4e6ff5f46dc9376f89 (patch)
treeebde269fc7a836b67eb8d7a2a95a90297d8c2435 /xeth
parent5ab0eaa06d2f5879b9b22778988410bd0c73dcc0 (diff)
parent9884eed0cf7c95074fd5b3d5f0f592a423810a8a (diff)
downloaddexon-49ded3aa7752148ebfbacd4e6ff5f46dc9376f89.tar.gz
dexon-49ded3aa7752148ebfbacd4e6ff5f46dc9376f89.tar.zst
dexon-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.go33
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
+}