Skip to content

Commit 3f649d4

Browse files
authored
core: collect NewTxsEvent items without holding reorg lock (#21145)
1 parent 5f6f5e3 commit 3f649d4

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

core/tx_pool.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,13 +1040,7 @@ func (pool *TxPool) runReorg(done chan struct{}, reset *txpoolResetRequest, dirt
10401040
}
10411041
// Check for pending transactions for every account that sent new ones
10421042
promoted := pool.promoteExecutables(promoteAddrs)
1043-
for _, tx := range promoted {
1044-
addr, _ := types.Sender(pool.signer, tx)
1045-
if _, ok := events[addr]; !ok {
1046-
events[addr] = newTxSortedMap()
1047-
}
1048-
events[addr].Put(tx)
1049-
}
1043+
10501044
// If a new block appeared, validate the pool of pending transactions. This will
10511045
// remove any transaction that has been included in the block or was invalidated
10521046
// because of another transaction (e.g. higher gas price).
@@ -1065,6 +1059,13 @@ func (pool *TxPool) runReorg(done chan struct{}, reset *txpoolResetRequest, dirt
10651059
pool.mu.Unlock()
10661060

10671061
// Notify subsystems for newly added transactions
1062+
for _, tx := range promoted {
1063+
addr, _ := types.Sender(pool.signer, tx)
1064+
if _, ok := events[addr]; !ok {
1065+
events[addr] = newTxSortedMap()
1066+
}
1067+
events[addr].Put(tx)
1068+
}
10681069
if len(events) > 0 {
10691070
var txs []*types.Transaction
10701071
for _, set := range events {

0 commit comments

Comments
 (0)