Official Go implementation of the Ethereum protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-ethereum/xeth/world.go

65 lines
1.1 KiB

package xeth
import (
"container/list"
10 years ago
"github.com/ethereum/go-ethereum/state"
)
10 years ago
type World struct {
pipe *XEth
10 years ago
cfg *Config
}
func NewWorld(pipe *XEth) *World {
10 years ago
world := &World{pipe, nil}
10 years ago
world.cfg = &Config{pipe}
return world
}
func (self *XEth) World() *World {
return self.world
}
func (self *World) State() *state.StateDB {
return self.pipe.blockManager.CurrentState()
}
10 years ago
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)}
}
10 years ago
func (self *World) safeGet(addr []byte) *state.StateObject {
object := self.State().GetStateObject(addr)
if object == nil {
10 years ago
object = state.NewStateObject(addr)
}
return object
}
10 years ago
func (self *World) Coinbase() *state.StateObject {
return nil
}
10 years ago
func (self *World) IsMining() bool {
return self.pipe.obj.IsMining()
}
10 years ago
func (self *World) IsListening() bool {
return self.pipe.obj.IsListening()
}
10 years ago
func (self *World) Peers() *list.List {
10 years ago
return self.pipe.obj.Peers()
}
10 years ago
func (self *World) Config() *Config {
return self.cfg
}