aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/state.go
diff options
context:
space:
mode:
authorAlexandre Van de Sande <alex.vandesande@ethdev.com>2015-03-04 21:04:07 +0800
committerAlexandre Van de Sande <alex.vandesande@ethdev.com>2015-03-04 21:04:07 +0800
commit5f25c117eb6a1145b18fc13ebc03e4dc570b908e (patch)
treef5296850d29c08179ac9f51c925463d880e2db08 /xeth/state.go
parentcf880f78d5e85d563654ac8277c1d51bf8c382c2 (diff)
parenta56243075a7527d65d14c4cf3480029feb0a1e3f (diff)
downloaddexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar.gz
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar.bz2
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar.lz
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar.xz
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.tar.zst
dexon-5f25c117eb6a1145b18fc13ebc03e4dc570b908e.zip
Merge branch 'develop' into ui
Diffstat (limited to 'xeth/state.go')
-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
+}