Skip to content

Commit 610adfd

Browse files
committed
fixed xeth.gpo = nil bug
1 parent 3c7b64c commit 610adfd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

xeth/xeth.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const (
4242
func DefaultGas() *big.Int { return new(big.Int).Set(defaultGas) }
4343

4444
func (self *XEth) DefaultGasPrice() *big.Int {
45+
if self.gpo == nil {
46+
self.gpo = eth.NewGasPriceOracle(self.backend)
47+
}
4548
return self.gpo.SuggestPrice()
4649
}
4750

@@ -96,7 +99,6 @@ func New(ethereum *eth.Ethereum, frontend Frontend) *XEth {
9699
transactionQueue: make(map[int]*hashQueue),
97100
messages: make(map[int]*whisperFilter),
98101
agent: miner.NewRemoteAgent(),
99-
gpo: eth.NewGasPriceOracle(ethereum),
100102
}
101103
if ethereum.Whisper() != nil {
102104
xeth.whisper = NewWhisper(ethereum.Whisper())
@@ -233,6 +235,7 @@ func (self *XEth) WithState(statedb *state.StateDB) *XEth {
233235
xeth := &XEth{
234236
backend: self.backend,
235237
frontend: self.frontend,
238+
gpo: self.gpo,
236239
}
237240

238241
xeth.state = NewState(xeth, statedb)

0 commit comments

Comments
 (0)