mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
core, event: txpool deliver tx in order
This commit is contained in:
parent
e51f65af1f
commit
01d594629a
2 changed files with 5 additions and 2 deletions
|
|
@ -394,7 +394,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
|
||||||
// Set the potentially new pending nonce and notify any subsystems of the new tx
|
// Set the potentially new pending nonce and notify any subsystems of the new tx
|
||||||
pool.beats[addr] = time.Now()
|
pool.beats[addr] = time.Now()
|
||||||
pool.pendingState.SetNonce(addr, tx.Nonce()+1)
|
pool.pendingState.SetNonce(addr, tx.Nonce()+1)
|
||||||
go pool.eventMux.Post(TxPreEvent{tx})
|
pool.eventMux.Post(TxPreEvent{tx})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add queues a single transaction in the pool if it is valid.
|
// Add queues a single transaction in the pool if it is valid.
|
||||||
|
|
|
||||||
|
|
@ -202,10 +202,13 @@ func (s *TypeMuxSubscription) deliver(event *TypeMuxEvent) {
|
||||||
}
|
}
|
||||||
// Otherwise deliver the event
|
// Otherwise deliver the event
|
||||||
s.postMu.RLock()
|
s.postMu.RLock()
|
||||||
defer s.postMu.RUnlock()
|
go deliver_goroutine(s, event)
|
||||||
|
}
|
||||||
|
|
||||||
|
func deliver_goroutine(s *TypeMuxSubscription, event *TypeMuxEvent) {
|
||||||
select {
|
select {
|
||||||
case s.postC <- event:
|
case s.postC <- event:
|
||||||
case <-s.closing:
|
case <-s.closing:
|
||||||
}
|
}
|
||||||
|
s.postMu.RUnlock()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue