@@ -431,6 +431,7 @@ func (pool *TxPool) loop() {
431
431
if time .Since (pool .beats [addr ]) > pool .config .Lifetime {
432
432
list := pool .queue [addr ].Flatten ()
433
433
for _ , tx := range list {
434
+ log .Trace ("Evicting transaction due to timeout" , "account" , addr .Hex (), "hash" , tx .Hash ().Hex (), "lifetime sec" , time .Since (pool .beats [addr ]).Seconds (), "lifetime limit sec" , pool .config .Lifetime .Seconds ())
434
435
pool .removeTx (tx .Hash (), true )
435
436
}
436
437
queuedEvictionMeter .Mark (int64 (len (list )))
@@ -787,13 +788,13 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
787
788
// If the transaction is already known, discard it
788
789
hash := tx .Hash ()
789
790
if pool .all .Get (hash ) != nil {
790
- log .Trace ("Discarding already known transaction" , "hash" , hash )
791
+ log .Trace ("Discarding already known transaction" , "hash" , hash . Hex () )
791
792
knownTxMeter .Mark (1 )
792
793
return false , ErrAlreadyKnown
793
794
}
794
795
795
796
if pool .IsMiner () && rawdb .IsSkippedTransaction (pool .chain .Database (), hash ) {
796
- log .Trace ("Discarding already known skipped transaction" , "hash" , hash )
797
+ log .Trace ("Discarding already known skipped transaction" , "hash" , hash . Hex () )
797
798
knownSkippedTxMeter .Mark (1 )
798
799
return false , ErrAlreadyKnown
799
800
}
@@ -804,15 +805,15 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
804
805
805
806
// If the transaction fails basic validation, discard it
806
807
if err := pool .validateTx (tx , isLocal ); err != nil {
807
- log .Trace ("Discarding invalid transaction" , "hash" , hash , "err" , err )
808
+ log .Trace ("Discarding invalid transaction" , "hash" , hash . Hex () , "err" , err )
808
809
invalidTxMeter .Mark (1 )
809
810
return false , err
810
811
}
811
812
// If the transaction pool is full, discard underpriced transactions
812
813
if uint64 (pool .all .Slots ()+ numSlots (tx )) > pool .config .GlobalSlots + pool .config .GlobalQueue {
813
814
// If the new transaction is underpriced, don't accept it
814
815
if ! isLocal && pool .priced .Underpriced (tx ) {
815
- log .Trace ("Discarding underpriced transaction" , "hash" , hash , "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap ())
816
+ log .Trace ("Discarding underpriced transaction" , "hash" , hash . Hex () , "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap ())
816
817
underpricedTxMeter .Mark (1 )
817
818
return false , ErrUnderpriced
818
819
}
@@ -832,7 +833,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
832
833
833
834
// Special case, we still can't make the room for the new remote one.
834
835
if ! isLocal && ! success {
835
- log .Trace ("Discarding overflown transaction" , "hash" , hash )
836
+ log .Trace ("Discarding overflown transaction" , "hash" , hash . Hex () )
836
837
overflowedTxMeter .Mark (1 )
837
838
return false , ErrTxPoolOverflow
838
839
}
@@ -865,7 +866,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
865
866
pool .priced .Put (tx , isLocal )
866
867
pool .journalTx (from , tx )
867
868
pool .queueTxEvent (tx )
868
- log .Trace ("Pooled new executable transaction" , "hash" , hash , "from" , from , "to" , tx .To ())
869
+ log .Trace ("Pooled new executable transaction" , "hash" , hash . Hex () , "from" , from . Hex () , "to" , tx .To ())
869
870
870
871
// Successful promotion, bump the heartbeat
871
872
pool .beats [from ] = time .Now ()
@@ -887,7 +888,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
887
888
}
888
889
pool .journalTx (from , tx )
889
890
890
- log .Trace ("Pooled new future transaction" , "hash" , hash , "from" , from , "to" , tx .To ())
891
+ log .Trace ("Pooled new future transaction" , "hash" , hash . Hex () , "from" , from . Hex () , "to" , tx .To ())
891
892
return replaced , nil
892
893
}
893
894
@@ -975,6 +976,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
975
976
// Nothing was replaced, bump the pending counter
976
977
pendingGauge .Inc (1 )
977
978
}
979
+ log .Trace ("Transaction promoted from future queue to pending" , "hash" , hash .Hex (), "from" , addr .Hex (), "to" , tx .To ())
978
980
// Set the potentially new pending nonce and notify any subsystems of the new tx
979
981
pool .pendingNonces .set (addr , tx .Nonce ()+ 1 )
980
982
@@ -1146,6 +1148,9 @@ func (pool *TxPool) removeTx(hash common.Hash, outofbound bool) {
1146
1148
if tx == nil {
1147
1149
return
1148
1150
}
1151
+
1152
+ log .Trace ("Removing transaction from pool" , "hash" , hash .Hex ())
1153
+
1149
1154
addr , _ := types .Sender (pool .signer , tx ) // already validated during insertion
1150
1155
1151
1156
// Remove it from the list of known transactions
@@ -1526,7 +1531,7 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Trans
1526
1531
hash := tx .Hash ()
1527
1532
pool .all .Remove (hash )
1528
1533
pool .calculateTxsLifecycle (types.Transactions {tx }, time .Now ())
1529
- log .Trace ("Removed cap-exceeding queued transaction" , "hash" , hash )
1534
+ log .Trace ("Removed cap-exceeding queued transaction" , "hash" , hash . Hex () )
1530
1535
}
1531
1536
queuedRateLimitMeter .Mark (int64 (len (caps )))
1532
1537
}
@@ -1612,7 +1617,7 @@ func (pool *TxPool) truncatePending() {
1612
1617
1613
1618
// Update the account nonce to the dropped transaction
1614
1619
pool .pendingNonces .setIfLower (offenders [i ], tx .Nonce ())
1615
- log .Trace ("Removed fairness-exceeding pending transaction" , "hash" , hash )
1620
+ log .Trace ("Removed fairness-exceeding pending transaction" , "hash" , hash . Hex () )
1616
1621
}
1617
1622
pool .priced .Removed (len (caps ))
1618
1623
pendingGauge .Dec (int64 (len (caps )))
@@ -1717,22 +1722,22 @@ func (pool *TxPool) demoteUnexecutables() {
1717
1722
hash := tx .Hash ()
1718
1723
pool .all .Remove (hash )
1719
1724
pool .calculateTxsLifecycle (types.Transactions {tx }, time .Now ())
1720
- log .Trace ("Removed old pending transaction" , "hash" , hash )
1725
+ log .Trace ("Removed old pending transaction" , "hash" , hash . Hex () )
1721
1726
}
1722
1727
// Drop all transactions that are too costly (low balance or out of gas), and queue any invalids back for later
1723
1728
costLimit := pool .currentState .GetBalance (addr )
1724
1729
drops , invalids := list .FilterF (costLimit , pool .currentMaxGas , pool .executableTxFilter (costLimit ))
1725
1730
for _ , tx := range drops {
1726
1731
hash := tx .Hash ()
1727
- log .Trace ("Removed unpayable pending transaction" , "hash" , hash )
1732
+ log .Trace ("Removed unpayable pending transaction" , "hash" , hash . Hex () )
1728
1733
pool .all .Remove (hash )
1729
1734
pool .calculateTxsLifecycle (types.Transactions {tx }, time .Now ())
1730
1735
}
1731
1736
pendingNofundsMeter .Mark (int64 (len (drops )))
1732
1737
1733
1738
for _ , tx := range invalids {
1734
1739
hash := tx .Hash ()
1735
- log .Trace ("Demoting pending transaction" , "hash" , hash )
1740
+ log .Trace ("Demoting pending transaction" , "hash" , hash . Hex () )
1736
1741
1737
1742
// Internal shuffle shouldn't touch the lookup set.
1738
1743
pool .enqueueTx (hash , tx , false , false )
@@ -1767,6 +1772,9 @@ func (pool *TxPool) calculateTxsLifecycle(txs types.Transactions, t time.Time) {
1767
1772
for _ , tx := range txs {
1768
1773
if tx .Time ().Before (t ) {
1769
1774
txLifecycle := t .Sub (tx .Time ())
1775
+ if txLifecycle >= time .Minute * 30 {
1776
+ log .Debug ("Transaction lifecycle exceeds 30 minutes" , "hash" , tx .Hash ().Hex (), "duration seconds" , txLifecycle .Seconds ())
1777
+ }
1770
1778
txLifecycleTimer .Update (txLifecycle )
1771
1779
}
1772
1780
}
0 commit comments