Commit a748afce authored by Jeffrey Wilcke's avatar Jeffrey Wilcke

core: txpool listen for ChainHeadEvent instead of ChainEvent

Changed the transaction pool to listen for ChainHeadEvent when resetting
the state instead of ChainEvent. It makes very little sense to burst
through transactions while we are catching up (e.g., have more than one
block to process)
parent c14f0a44
...@@ -65,7 +65,7 @@ func NewTxPool(eventMux *event.TypeMux, currentStateFn stateFn, gasLimitFn func( ...@@ -65,7 +65,7 @@ func NewTxPool(eventMux *event.TypeMux, currentStateFn stateFn, gasLimitFn func(
gasLimit: gasLimitFn, gasLimit: gasLimitFn,
minGasPrice: new(big.Int), minGasPrice: new(big.Int),
pendingState: state.ManageState(currentStateFn()), pendingState: state.ManageState(currentStateFn()),
events: eventMux.Subscribe(ChainEvent{}, GasPriceChanged{}), events: eventMux.Subscribe(ChainHeadEvent{}, GasPriceChanged{}),
} }
go pool.eventLoop() go pool.eventLoop()
...@@ -80,7 +80,7 @@ func (pool *TxPool) eventLoop() { ...@@ -80,7 +80,7 @@ func (pool *TxPool) eventLoop() {
pool.mu.Lock() pool.mu.Lock()
switch ev := ev.(type) { switch ev := ev.(type) {
case ChainEvent: case ChainHeadEvent:
pool.resetState() pool.resetState()
case GasPriceChanged: case GasPriceChanged:
pool.minGasPrice = ev.Price pool.minGasPrice = ev.Price
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment