소스 검색

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)
Jeffrey Wilcke 10 년 전
부모
커밋
a748afce03
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      core/transaction_pool.go

+ 2 - 2
core/transaction_pool.go

@@ -65,7 +65,7 @@ func NewTxPool(eventMux *event.TypeMux, currentStateFn stateFn, gasLimitFn func(
 		gasLimit:     gasLimitFn,
 		minGasPrice:  new(big.Int),
 		pendingState: state.ManageState(currentStateFn()),
-		events:       eventMux.Subscribe(ChainEvent{}, GasPriceChanged{}),
+		events:       eventMux.Subscribe(ChainHeadEvent{}, GasPriceChanged{}),
 	}
 	go pool.eventLoop()
 
@@ -80,7 +80,7 @@ func (pool *TxPool) eventLoop() {
 		pool.mu.Lock()
 
 		switch ev := ev.(type) {
-		case ChainEvent:
+		case ChainHeadEvent:
 			pool.resetState()
 		case GasPriceChanged:
 			pool.minGasPrice = ev.Price