diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-20 09:34:12 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-20 09:34:12 +0800 |
commit | 3983dd2428137211f84f299f9ce8690c22f50afd (patch) | |
tree | 3a2dc53b365e6f377fc82a3514150d1297fe549c /xeth/world.go | |
parent | 7daa8c2f6eb25511c6a54ad420709af911fc6748 (diff) | |
parent | 0a9dc1536c5d776844d6947a0090ff7e1a7c6ab4 (diff) | |
download | go-tangerine-63766f5809b5f59c77e93bf02278c7d1c20f781e.tar go-tangerine-63766f5809b5f59c77e93bf02278c7d1c20f781e.tar.gz go-tangerine-63766f5809b5f59c77e93bf02278c7d1c20f781e.tar.bz2 go-tangerine-63766f5809b5f59c77e93bf02278c7d1c20f781e.tar.lz go-tangerine-63766f5809b5f59c77e93bf02278c7d1c20f781e.tar.xz go-tangerine-63766f5809b5f59c77e93bf02278c7d1c20f781e.tar.zst go-tangerine-63766f5809b5f59c77e93bf02278c7d1c20f781e.zip |
Merge branch 'release/v0.7.10'vv0.7.10
Diffstat (limited to 'xeth/world.go')
-rw-r--r-- | xeth/world.go | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/xeth/world.go b/xeth/world.go new file mode 100644 index 000000000..956ef1e15 --- /dev/null +++ b/xeth/world.go @@ -0,0 +1,64 @@ +package xeth + +import ( + "container/list" + + "github.com/ethereum/go-ethereum/state" +) + +type World struct { + pipe *XEth + cfg *Config +} + +func NewWorld(pipe *XEth) *World { + world := &World{pipe, nil} + world.cfg = &Config{pipe} + + return world +} + +func (self *XEth) World() *World { + return self.world +} + +func (self *World) State() *state.StateDB { + return self.pipe.chainManager.State() +} + +func (self *World) Get(addr []byte) *Object { + return &Object{self.State().GetStateObject(addr)} +} + +func (self *World) SafeGet(addr []byte) *Object { + return &Object{self.safeGet(addr)} +} + +func (self *World) safeGet(addr []byte) *state.StateObject { + object := self.State().GetStateObject(addr) + if object == nil { + object = state.NewStateObject(addr) + } + + return object +} + +func (self *World) Coinbase() *state.StateObject { + return nil +} + +func (self *World) IsMining() bool { + return self.pipe.obj.IsMining() +} + +func (self *World) IsListening() bool { + return self.pipe.obj.IsListening() +} + +func (self *World) Peers() *list.List { + return self.pipe.obj.Peers() +} + +func (self *World) Config() *Config { + return self.cfg +} |