world => World

pull/150/head
obscuren 10 years ago
parent e71b198e3d
commit 3c78e418fb
  1. 2
      ethpipe/pipe.go
  2. 24
      ethpipe/world.go

@ -21,7 +21,7 @@ type Pipe struct {
obj ethchain.EthManager obj ethchain.EthManager
stateManager *ethchain.StateManager stateManager *ethchain.StateManager
blockChain *ethchain.BlockChain blockChain *ethchain.BlockChain
world *world world *World
Vm VmVars Vm VmVars
} }

@ -6,31 +6,31 @@ import (
"github.com/ethereum/eth-go/ethstate" "github.com/ethereum/eth-go/ethstate"
) )
type world struct { type World struct {
pipe *Pipe pipe *Pipe
cfg *config cfg *config
} }
func NewWorld(pipe *Pipe) *world { func NewWorld(pipe *Pipe) *World {
world := &world{pipe, nil} world := &World{pipe, nil}
world.cfg = &config{pipe} world.cfg = &config{pipe}
return world return world
} }
func (self *Pipe) World() *world { func (self *Pipe) World() *World {
return self.world return self.world
} }
func (self *world) State() *ethstate.State { func (self *World) State() *ethstate.State {
return self.pipe.stateManager.CurrentState() return self.pipe.stateManager.CurrentState()
} }
func (self *world) Get(addr []byte) *Object { func (self *World) Get(addr []byte) *Object {
return &Object{self.State().GetStateObject(addr)} return &Object{self.State().GetStateObject(addr)}
} }
func (self *world) safeGet(addr []byte) *ethstate.StateObject { func (self *World) safeGet(addr []byte) *ethstate.StateObject {
object := self.State().GetStateObject(addr) object := self.State().GetStateObject(addr)
if object == nil { if object == nil {
object = ethstate.NewStateObject(addr) object = ethstate.NewStateObject(addr)
@ -39,22 +39,22 @@ func (self *world) safeGet(addr []byte) *ethstate.StateObject {
return object return object
} }
func (self *world) Coinbase() *ethstate.StateObject { func (self *World) Coinbase() *ethstate.StateObject {
return nil return nil
} }
func (self *world) IsMining() bool { func (self *World) IsMining() bool {
return self.pipe.obj.IsMining() return self.pipe.obj.IsMining()
} }
func (self *world) IsListening() bool { func (self *World) IsListening() bool {
return self.pipe.obj.IsListening() return self.pipe.obj.IsListening()
} }
func (self *world) Peers() *list.List { func (self *World) Peers() *list.List {
return self.pipe.obj.Peers() return self.pipe.obj.Peers()
} }
func (self *world) Config() *config { func (self *World) Config() *config {
return self.cfg return self.cfg
} }

Loading…
Cancel
Save