Skip to content

Commit a633a2d

Browse files
committed
core: Prevent local tx:s from being discarded
1 parent 67aff49 commit a633a2d

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

‎core/tx_pool.go‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -725,12 +725,14 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB, accounts []common.A
725725
pool.promoteTx(addr, hash, tx)
726726
}
727727
// Drop all transactions over the allowed limit
728-
for _, tx := range list.Cap(int(pool.config.AccountQueue)) {
729-
hash := tx.Hash()
730-
delete(pool.all, hash)
731-
pool.priced.Removed()
732-
queuedRateLimitCounter.Inc(1)
733-
log.Trace("Removed cap-exceeding queued transaction", "hash", hash)
728+
if !pool.locals.containsAddress(addr) {
729+
for _, tx := range list.Cap(int(pool.config.AccountQueue)) {
730+
hash := tx.Hash()
731+
delete(pool.all, hash)
732+
pool.priced.Removed()
733+
queuedRateLimitCounter.Inc(1)
734+
log.Trace("Removed cap-exceeding queued transaction", "hash", hash)
735+
}
734736
}
735737
queued += uint64(list.Len())
736738

@@ -815,7 +817,10 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB, accounts []common.A
815817
// Sort all accounts with queued transactions by heartbeat
816818
addresses := make(addresssByHeartbeat, 0, len(pool.queue))
817819
for addr := range pool.queue {
818-
addresses = append(addresses, addressByHeartbeat{addr, pool.beats[addr]})
820+
// Don't drop locals
821+
if !pool.locals.containsAddress(addr) {
822+
addresses = append(addresses, addressByHeartbeat{addr, pool.beats[addr]})
823+
}
819824
}
820825
sort.Sort(addresses)
821826

0 commit comments

Comments
 (0)