fixed xeth.gpo = nil bug

This commit is contained in:
zsfelfoldi 2015-06-12 13:57:30 +02:00
parent 3c7b64ce20
commit 610adfd83f
1 changed files with 4 additions and 1 deletions

View File

@ -42,6 +42,9 @@ const (
func DefaultGas() *big.Int { return new(big.Int).Set(defaultGas) } func DefaultGas() *big.Int { return new(big.Int).Set(defaultGas) }
func (self *XEth) DefaultGasPrice() *big.Int { func (self *XEth) DefaultGasPrice() *big.Int {
if self.gpo == nil {
self.gpo = eth.NewGasPriceOracle(self.backend)
}
return self.gpo.SuggestPrice() return self.gpo.SuggestPrice()
} }
@ -96,7 +99,6 @@ func New(ethereum *eth.Ethereum, frontend Frontend) *XEth {
transactionQueue: make(map[int]*hashQueue), transactionQueue: make(map[int]*hashQueue),
messages: make(map[int]*whisperFilter), messages: make(map[int]*whisperFilter),
agent: miner.NewRemoteAgent(), agent: miner.NewRemoteAgent(),
gpo: eth.NewGasPriceOracle(ethereum),
} }
if ethereum.Whisper() != nil { if ethereum.Whisper() != nil {
xeth.whisper = NewWhisper(ethereum.Whisper()) xeth.whisper = NewWhisper(ethereum.Whisper())
@ -233,6 +235,7 @@ func (self *XEth) WithState(statedb *state.StateDB) *XEth {
xeth := &XEth{ xeth := &XEth{
backend: self.backend, backend: self.backend,
frontend: self.frontend, frontend: self.frontend,
gpo: self.gpo,
} }
xeth.state = NewState(xeth, statedb) xeth.state = NewState(xeth, statedb)