@@ -106,7 +106,7 @@ var (
106106 evictionInterval = time .Minute // Time interval to check for evictable transactions
107107 statsReportInterval = 8 * time .Second // Time interval to report transaction pool stats
108108
109- dumpReorgTxHashThreshold = 100 // Number of transaction hashse to dump when runReorg
109+ dumpReorgTxHashThreshold = 100 // Number of transaction hashes to dump when runReorg
110110)
111111
112112var (
@@ -467,7 +467,7 @@ func (pool *TxPool) loop() {
467467 if time .Since (pool .beats [addr ]) > pool .config .Lifetime {
468468 list := pool .queue [addr ].Flatten ()
469469 for _ , tx := range list {
470- log .Trace ("Evicting queued 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 ())
470+ log .Debug ("Evicting queued 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 ())
471471 pool .removeTx (tx .Hash (), true )
472472 }
473473 queuedEvictionMeter .Mark (int64 (len (list )))
@@ -483,7 +483,7 @@ func (pool *TxPool) loop() {
483483 if time .Since (pool .beats [addr ]) > pool .config .Lifetime {
484484 list := pool .pending [addr ].Flatten ()
485485 for _ , tx := range list {
486- log .Trace ("Evicting pending 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 ())
486+ log .Debug ("Evicting pending 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 ())
487487 pool .removeTx (tx .Hash (), true )
488488 }
489489 pendingEvictionMeter .Mark (int64 (len (list )))
@@ -546,6 +546,7 @@ func (pool *TxPool) SetGasPrice(price *big.Int) {
546546 // pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead
547547 drop := pool .all .RemotesBelowTip (price )
548548 for _ , tx := range drop {
549+ log .Debug ("Removing transaction below price limit" , "hash" , tx .Hash ().Hex (), "price" , tx .GasFeeCap ().String (), "limit" , price .String ())
549550 pool .removeTx (tx .Hash (), false )
550551 }
551552 pool .priced .Removed (len (drop ))
@@ -852,13 +853,13 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
852853 // If the transaction is already known, discard it
853854 hash := tx .Hash ()
854855 if pool .all .Get (hash ) != nil {
855- log .Trace ("Discarding already known transaction" , "hash" , hash .Hex ())
856+ log .Debug ("Discarding already known transaction when adding the transaction" , "hash" , hash .Hex ())
856857 knownTxMeter .Mark (1 )
857858 return false , ErrAlreadyKnown
858859 }
859860
860861 if pool .IsMiner () && rawdb .IsSkippedTransaction (pool .chain .Database (), hash ) {
861- log .Trace ("Discarding already known skipped transaction" , "hash" , hash .Hex ())
862+ log .Debug ("Discarding already known skipped transaction when adding the transaction" , "hash" , hash .Hex ())
862863 knownSkippedTxMeter .Mark (1 )
863864 return false , ErrAlreadyKnown
864865 }
@@ -869,15 +870,15 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
869870
870871 // If the transaction fails basic validation, discard it
871872 if err := pool .validateTx (tx , isLocal ); err != nil {
872- log .Trace ("Discarding invalid transaction" , "hash" , hash .Hex (), "err" , err )
873+ log .Debug ("Discarding invalid transaction when adding the transaction" , "hash" , hash .Hex (), "err" , err )
873874 invalidTxMeter .Mark (1 )
874875 return false , err
875876 }
876877 // If the transaction pool is full, discard underpriced transactions
877878 if uint64 (pool .all .Slots ()+ numSlots (tx )) > pool .config .GlobalSlots + pool .config .GlobalQueue {
878879 // If the new transaction is underpriced, don't accept it
879880 if ! isLocal && pool .priced .Underpriced (tx ) {
880- log .Trace ("Discarding underpriced transaction" , "hash" , hash .Hex (), "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap ())
881+ log .Debug ("Discarding underpriced transaction when transaction pool is full " , "hash" , hash .Hex (), "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap ())
881882 underpricedTxMeter .Mark (1 )
882883 return false , ErrUnderpriced
883884 }
@@ -897,15 +898,15 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
897898
898899 // Special case, we still can't make the room for the new remote one.
899900 if ! isLocal && ! success {
900- log .Trace ("Discarding overflown transaction" , "hash" , hash .Hex ())
901+ log .Debug ("Discarding overflown transaction when transaction pool is full " , "hash" , hash .Hex (), "gasTipCap" , tx . GasTipCap (), "gasFeeCap" , tx . GasFeeCap ())
901902 overflowedTxMeter .Mark (1 )
902903 return false , ErrTxPoolOverflow
903904 }
904905 // Bump the counter of rejections-since-reorg
905906 pool .changesSinceReorg += len (drop )
906907 // Kick out the underpriced remote transactions.
907908 for _ , tx := range drop {
908- log .Trace ("Discarding freshly underpriced transaction" , "hash" , tx .Hash (), "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap ())
909+ log .Debug ("Discarding underpriced transaction when transaction pool is full " , "hash" , tx .Hash (). Hex (), "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap ())
909910 underpricedTxMeter .Mark (1 )
910911 pool .removeTx (tx .Hash (), false )
911912 }
@@ -916,11 +917,13 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
916917 // Nonce already pending, check if required price bump is met
917918 inserted , old := list .Add (tx , pool .currentState , pool .config .PriceBump , pool .chainconfig , pool .currentHead )
918919 if ! inserted {
920+ log .Debug ("Discarding underpriced pending transaction" , "hash" , hash .Hex (), "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap ())
919921 pendingDiscardMeter .Mark (1 )
920922 return false , ErrReplaceUnderpriced
921923 }
922924 // New transaction is better, replace old one
923925 if old != nil {
926+ log .Debug ("Replacing pending transaction" , "hash" , tx .Hash ().Hex (), "old" , old .Hash ().Hex ())
924927 pool .all .Remove (old .Hash ())
925928 pool .calculateTxsLifecycle (types.Transactions {old }, time .Now ())
926929 pool .priced .Removed (1 )
@@ -930,7 +933,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
930933 pool .priced .Put (tx , isLocal )
931934 pool .journalTx (from , tx )
932935 pool .queueTxEvent (tx )
933- log .Trace ("Pooled new executable transaction" , "hash" , hash .Hex (), "from" , from .Hex (), "to" , tx .To ())
936+ log .Debug ("Pooled new executable transaction" , "hash" , hash .Hex (), "from" , from .Hex (), "to" , tx .To (), "gasTipCap" , tx . GasTipCap (), "gasFeeCap" , tx . GasFeeCap ())
934937
935938 // Successful promotion, bump the heartbeat
936939 pool .beats [from ] = time .Now ()
@@ -952,7 +955,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
952955 }
953956 pool .journalTx (from , tx )
954957
955- log .Trace ("Pooled new future transaction" , "hash" , hash .Hex (), "from" , from .Hex (), "to" , tx .To ())
958+ log .Debug ("Pooled new future transaction" , "hash" , hash .Hex (), "from" , from .Hex (), "to" , tx .To (), "gasTipCap" , tx . GasTipCap (), "gasFeeCap" , tx . GasFeeCap ())
956959 return replaced , nil
957960}
958961
@@ -969,11 +972,13 @@ func (pool *TxPool) enqueueTx(hash common.Hash, tx *types.Transaction, local boo
969972 inserted , old := pool .queue [from ].Add (tx , pool .currentState , pool .config .PriceBump , pool .chainconfig , pool .currentHead )
970973 if ! inserted {
971974 // An older transaction was better, discard this
975+ log .Debug ("Discarding underpriced queued transaction" , "hash" , hash .Hex (), "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap ())
972976 queuedDiscardMeter .Mark (1 )
973977 return false , ErrReplaceUnderpriced
974978 }
975979 // Discard any previous transaction and mark this
976980 if old != nil {
981+ log .Debug ("Replacing queued transaction" , "hash" , tx .Hash ().Hex (), "old" , old .Hash ().Hex ())
977982 pool .all .Remove (old .Hash ())
978983 pool .priced .Removed (1 )
979984 pool .calculateTxsLifecycle (types.Transactions {old }, time .Now ())
@@ -1023,6 +1028,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
10231028
10241029 // Account pending list is full
10251030 if uint64 (list .Len ()) >= pool .config .AccountPendingLimit {
1031+ log .Debug ("Discarding pending transaction when account pending limit is reached" , "hash" , hash .Hex (), "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap ())
10261032 pool .all .Remove (hash )
10271033 pool .calculateTxsLifecycle (types.Transactions {tx }, time .Now ())
10281034 pool .priced .Removed (1 )
@@ -1033,6 +1039,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
10331039 inserted , old := list .Add (tx , pool .currentState , pool .config .PriceBump , pool .chainconfig , pool .currentHead )
10341040 if ! inserted {
10351041 // An older transaction was better, discard this
1042+ log .Debug ("Discarding underpriced pending transaction" , "hash" , hash .Hex (), "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap ())
10361043 pool .all .Remove (hash )
10371044 pool .calculateTxsLifecycle (types.Transactions {tx }, time .Now ())
10381045 pool .priced .Removed (1 )
@@ -1041,6 +1048,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
10411048 }
10421049 // Otherwise discard any previous transaction and mark this
10431050 if old != nil {
1051+ log .Debug ("Replacing pending transaction" , "hash" , tx .Hash ().Hex (), "old" , old .Hash ().Hex ())
10441052 pool .all .Remove (old .Hash ())
10451053 pool .calculateTxsLifecycle (types.Transactions {old }, time .Now ())
10461054 pool .priced .Removed (1 )
@@ -1049,7 +1057,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
10491057 // Nothing was replaced, bump the pending counter
10501058 pendingGauge .Inc (1 )
10511059 }
1052- log .Trace ("Transaction promoted from future queue to pending" , "hash" , hash .Hex (), "from" , addr .Hex (), "to" , tx .To ())
1060+ log .Debug ("Transaction promoted from future queue to pending" , "hash" , hash .Hex (), "from" , addr .Hex (), "to" , tx .To ())
10531061 // Set the potentially new pending nonce and notify any subsystems of the new tx
10541062 pool .pendingNonces .set (addr , tx .Nonce ()+ 1 )
10551063
@@ -1222,7 +1230,7 @@ func (pool *TxPool) removeTx(hash common.Hash, outofbound bool) {
12221230 return
12231231 }
12241232
1225- log .Trace ("Removing transaction from pool" , "hash" , hash .Hex ())
1233+ log .Debug ("Removing transaction from pool" , "hash" , hash .Hex ())
12261234
12271235 addr , _ := types .Sender (pool .signer , tx ) // already validated during insertion
12281236
@@ -1452,10 +1460,10 @@ func (pool *TxPool) runReorg(done chan struct{}, reset *txpoolResetRequest, dirt
14521460 }
14531461 pool .txFeed .Send (NewTxsEvent {txs })
14541462
1455- log .Debug ("runReorg" , "len(txs)" , len (txs ))
1463+ log .Trace ("runReorg" , "len(txs)" , len (txs ))
14561464 if len (txs ) > dumpReorgTxHashThreshold {
14571465 for _ , txs := range txs {
1458- log .Debug ("dumping runReorg tx hashes" , "txHash" , txs .Hash ().Hex ())
1466+ log .Trace ("dumping runReorg tx hashes" , "txHash" , txs .Hash ().Hex ())
14591467 }
14601468 }
14611469 }
@@ -1524,6 +1532,15 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
15241532 }
15251533 }
15261534 reinject = types .TxDifference (discarded , included )
1535+
1536+ for _ , tx := range discarded {
1537+ log .Debug ("TXPOOL_REORG: TX removed from old chain" , "hash" , tx .Hash ().Hex ())
1538+ }
1539+
1540+ for _ , tx := range included {
1541+ log .Debug ("TXPOOL_REORG: TX added in the chain" , "hash" , tx .Hash ().Hex ())
1542+ }
1543+
15271544 }
15281545 }
15291546 }
@@ -1541,7 +1558,9 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
15411558 pool .currentMaxGas = newHead .GasLimit
15421559
15431560 // Inject any transactions discarded due to reorgs
1544- log .Debug ("Reinjecting stale transactions" , "count" , len (reinject ))
1561+ if len (reinject ) > 0 {
1562+ log .Debug ("Reinjecting stale transactions" , "count" , len (reinject ))
1563+ }
15451564 senderCacher .recover (pool .signer , reinject )
15461565 pool .addTxsLocked (reinject , false )
15471566
@@ -1577,6 +1596,9 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Trans
15771596 hash := tx .Hash ()
15781597 pool .all .Remove (hash )
15791598 pool .calculateTxsLifecycle (types.Transactions {tx }, time .Now ())
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 ())
15801602 }
15811603 log .Trace ("Removed old queued transactions" , "count" , len (forwards ))
15821604
@@ -1587,6 +1609,7 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Trans
15871609 hash := tx .Hash ()
15881610 pool .all .Remove (hash )
15891611 pool .calculateTxsLifecycle (types.Transactions {tx }, time .Now ())
1612+ log .Debug ("Removed unpayable queued transaction" , "hash" , hash .Hex ())
15901613 }
15911614 log .Trace ("Removed unpayable queued transactions" , "count" , len (drops ))
15921615 queuedNofundsMeter .Mark (int64 (len (drops )))
@@ -1610,7 +1633,7 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Trans
16101633 hash := tx .Hash ()
16111634 pool .all .Remove (hash )
16121635 pool .calculateTxsLifecycle (types.Transactions {tx }, time .Now ())
1613- log .Trace ("Removed cap-exceeding queued transaction" , "hash" , hash .Hex ())
1636+ log .Debug ("Removed cap-exceeding queued transaction" , "hash" , hash .Hex ())
16141637 }
16151638 queuedRateLimitMeter .Mark (int64 (len (caps )))
16161639 }
@@ -1668,7 +1691,7 @@ func (pool *TxPool) truncatePending() {
16681691 // Update the account nonce to the dropped transaction
16691692 // note: this will set pending nonce to the min nonce from the discarded txs
16701693 pool .pendingNonces .setIfLower (addr , tx .Nonce ())
1671- log .Trace ("Removed pending transaction to comply with hard limit" , "hash" , hash .Hex ())
1694+ log .Debug ("Removed pending transaction to comply with hard limit" , "hash" , hash .Hex ())
16721695 }
16731696 pool .priced .Removed (len (caps ))
16741697 pendingGauge .Dec (int64 (len (caps )))
@@ -1721,7 +1744,7 @@ func (pool *TxPool) truncatePending() {
17211744
17221745 // Update the account nonce to the dropped transaction
17231746 pool .pendingNonces .setIfLower (offenders [i ], tx .Nonce ())
1724- log .Trace ("Removed fairness-exceeding pending transaction" , "hash" , hash .Hex ())
1747+ log .Debug ("Removed fairness-exceeding pending transaction" , "hash" , hash .Hex ())
17251748 }
17261749 pool .priced .Removed (len (caps ))
17271750 pendingGauge .Dec (int64 (len (caps )))
@@ -1749,7 +1772,7 @@ func (pool *TxPool) truncatePending() {
17491772
17501773 // Update the account nonce to the dropped transaction
17511774 pool .pendingNonces .setIfLower (addr , tx .Nonce ())
1752- log .Trace ("Removed fairness-exceeding pending transaction" , "hash" , hash )
1775+ log .Debug ("Removed fairness-exceeding pending transaction" , "hash" , hash . Hex () )
17531776 }
17541777 pool .priced .Removed (len (caps ))
17551778 pendingGauge .Dec (int64 (len (caps )))
@@ -1792,6 +1815,7 @@ func (pool *TxPool) truncateQueue() {
17921815 // Drop all transactions if they are less than the overflow
17931816 if size := uint64 (list .Len ()); size <= drop {
17941817 for _ , tx := range list .Flatten () {
1818+ log .Debug ("Removed fairness-exceeding queued transaction" , "hash" , tx .Hash ().Hex ())
17951819 pool .removeTx (tx .Hash (), true )
17961820 }
17971821 drop -= size
@@ -1801,6 +1825,7 @@ func (pool *TxPool) truncateQueue() {
18011825 // Otherwise drop only last few transactions
18021826 txs := list .Flatten ()
18031827 for i := len (txs ) - 1 ; i >= 0 && drop > 0 ; i -- {
1828+ log .Debug ("Removed fairness-exceeding queued transaction" , "hash" , txs [i ].Hash ().Hex ())
18041829 pool .removeTx (txs [i ].Hash (), true )
18051830 drop --
18061831 queuedRateLimitMeter .Mark (1 )
@@ -1826,22 +1851,24 @@ func (pool *TxPool) demoteUnexecutables() {
18261851 hash := tx .Hash ()
18271852 pool .all .Remove (hash )
18281853 pool .calculateTxsLifecycle (types.Transactions {tx }, time .Now ())
1829- log .Trace ("Removed old pending transaction" , "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 ())
18301857 }
18311858 // Drop all transactions that are too costly (low balance or out of gas), and queue any invalids back for later
18321859 costLimit := pool .currentState .GetBalance (addr )
18331860 drops , invalids := list .FilterF (costLimit , pool .currentMaxGas , pool .executableTxFilter (costLimit ))
18341861 for _ , tx := range drops {
18351862 hash := tx .Hash ()
1836- log .Trace ("Removed unpayable pending transaction" , "hash" , hash .Hex ())
18371863 pool .all .Remove (hash )
18381864 pool .calculateTxsLifecycle (types.Transactions {tx }, time .Now ())
1865+ log .Debug ("Removed unpayable pending transaction" , "hash" , hash .Hex ())
18391866 }
18401867 pendingNofundsMeter .Mark (int64 (len (drops )))
18411868
18421869 for _ , tx := range invalids {
18431870 hash := tx .Hash ()
1844- log .Trace ("Demoting pending transaction" , "hash" , hash .Hex ())
1871+ log .Debug ("Demoting pending transaction" , "hash" , hash .Hex ())
18451872
18461873 // Internal shuffle shouldn't touch the lookup set.
18471874 pool .enqueueTx (hash , tx , false , false )
@@ -1855,7 +1882,7 @@ func (pool *TxPool) demoteUnexecutables() {
18551882 gapped := list .Cap (0 )
18561883 for _ , tx := range gapped {
18571884 hash := tx .Hash ()
1858- log .Error ("Demoting invalidated transaction" , "hash" , hash )
1885+ log .Error ("Demoting invalidated transaction" , "hash" , hash . Hex () )
18591886
18601887 // Internal shuffle shouldn't touch the lookup set.
18611888 pool .enqueueTx (hash , tx , false , false )
0 commit comments