// New creates an XEth that uses the given frontend. // If a nil Frontend is provided, a default frontend which // confirms all transactions will be used. func New(expanse *exp.Expanse, frontend Frontend) *XEth { xeth := &XEth{ backend: expanse, frontend: frontend, quit: make(chan struct{}), filterManager: filters.NewFilterSystem(expanse.EventMux()), logQueue: make(map[int]*logQueue), blockQueue: make(map[int]*hashQueue), transactionQueue: make(map[int]*hashQueue), messages: make(map[int]*whisperFilter), agent: miner.NewRemoteAgent(), gpo: exp.NewGasPriceOracle(expanse), } if expanse.Whisper() != nil { xeth.whisper = NewWhisper(expanse.Whisper()) } expanse.Miner().Register(xeth.agent) if frontend == nil { xeth.frontend = dummyFrontend{} } state, _ := xeth.backend.BlockChain().State() xeth.state = NewState(xeth, state) go xeth.start() return xeth }
func (self *XEth) DefaultGasPrice() *big.Int { if self.gpo == nil { self.gpo = exp.NewGasPriceOracle(self.backend) } return self.gpo.SuggestPrice() }