Skip to content

Commit 43ac794

Browse files
author
colinlyguo
committed
tweak logs
1 parent b128bff commit 43ac794

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

core/tx_pool.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,9 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
15581558
pool.currentMaxGas = newHead.GasLimit
15591559

15601560
// Inject any transactions discarded due to reorgs
1561-
log.Debug("Reinjecting stale transactions", "count", len(reinject))
1561+
if len(reinject) > 0 {
1562+
log.Debug("Reinjecting stale transactions", "count", len(reinject))
1563+
}
15621564
senderCacher.recover(pool.signer, reinject)
15631565
pool.addTxsLocked(reinject, false)
15641566

@@ -1594,7 +1596,9 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Trans
15941596
hash := tx.Hash()
15951597
pool.all.Remove(hash)
15961598
pool.calculateTxsLifecycle(types.Transactions{tx}, time.Now())
1597-
log.Debug("Removed queued transaction with low nonce", "hash", hash.Hex())
1599+
// This is a special case where the transaction was already included in a block,
1600+
// thus no need to mark it as removed, setting a trace log level to avoid confusion.
1601+
log.Trace("Removed queued transaction with low nonce", "hash", hash.Hex())
15981602
}
15991603
log.Trace("Removed old queued transactions", "count", len(forwards))
16001604

@@ -1847,7 +1851,9 @@ func (pool *TxPool) demoteUnexecutables() {
18471851
hash := tx.Hash()
18481852
pool.all.Remove(hash)
18491853
pool.calculateTxsLifecycle(types.Transactions{tx}, time.Now())
1850-
log.Debug("Removed pending transaction with low nonce", "hash", hash.Hex())
1854+
// This is a special case where the transaction was already included in a block,
1855+
// thus no need to mark it as removed, setting a trace log level to avoid confusion.
1856+
log.Trace("Removed pending transaction with low nonce", "hash", hash.Hex())
18511857
}
18521858
// Drop all transactions that are too costly (low balance or out of gas), and queue any invalids back for later
18531859
costLimit := pool.currentState.GetBalance(addr)

0 commit comments

Comments
 (0)