@@ -110,9 +110,9 @@ var (
110110 invalidTxMeter = metrics .NewRegisteredMeter ("txpool/invalid" , nil )
111111 underpricedTxMeter = metrics .NewRegisteredMeter ("txpool/underpriced" , nil )
112112
113- pendingCounter = metrics .NewRegisteredCounter ("txpool/pending" , nil )
114- queuedCounter = metrics .NewRegisteredCounter ("txpool/queued" , nil )
115- localCounter = metrics .NewRegisteredCounter ("txpool/local" , nil )
113+ pendingGauge = metrics .NewRegisteredGauge ("txpool/pending" , nil )
114+ queuedGauge = metrics .NewRegisteredGauge ("txpool/queued" , nil )
115+ localGauge = metrics .NewRegisteredGauge ("txpool/local" , nil )
116116)
117117
118118// TxStatus is the current status of a transaction as seen by the pool.
@@ -730,7 +730,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
730730 }
731731 }
732732 if local || pool .locals .contains (from ) {
733- localCounter .Inc (1 )
733+ localGauge .Inc (1 )
734734 }
735735 pool .journalTx (from , tx )
736736
@@ -760,7 +760,7 @@ func (pool *TxPool) enqueueTx(hash common.Hash, tx *types.Transaction) (bool, er
760760 queuedReplaceMeter .Mark (1 )
761761 } else {
762762 // Nothing was replaced, bump the queued counter
763- queuedCounter .Inc (1 )
763+ queuedGauge .Inc (1 )
764764 }
765765 if pool .all .Get (hash ) == nil {
766766 pool .all .Add (tx )
@@ -809,7 +809,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
809809 pendingReplaceMeter .Mark (1 )
810810 } else {
811811 // Nothing was replaced, bump the pending counter
812- pendingCounter .Inc (1 )
812+ pendingGauge .Inc (1 )
813813 }
814814 // Failsafe to work around direct pending inserts (tests)
815815 if pool .all .Get (hash ) == nil {
@@ -840,7 +840,7 @@ func (pool *TxPool) promoteSpecialTx(addr common.Address, tx *types.Transaction)
840840 pendingReplaceMeter .Mark (1 )
841841 } else {
842842 // Nothing was replaced, bump the pending counter
843- pendingCounter .Inc (1 )
843+ pendingGauge .Inc (1 )
844844 }
845845 list .txs .Put (tx )
846846 if cost := tx .Cost (); list .costcap .Cmp (cost ) < 0 {
@@ -980,7 +980,7 @@ func (pool *TxPool) removeTx(hash common.Hash, outofbound bool) {
980980 pool .priced .Removed (1 )
981981 }
982982 if pool .locals .contains (addr ) {
983- localCounter .Dec (1 )
983+ localGauge .Dec (1 )
984984 }
985985 // Remove the transaction from the pending lists and reset the account nonce
986986 if pending := pool .pending [addr ]; pending != nil {
@@ -997,15 +997,15 @@ func (pool *TxPool) removeTx(hash common.Hash, outofbound bool) {
997997 // Update the account nonce if needed
998998 pool .pendingNonces .setIfLower (addr , tx .Nonce ())
999999 // Reduce the pending counter
1000- pendingCounter .Dec (int64 (1 + len (invalids )))
1000+ pendingGauge .Dec (int64 (1 + len (invalids )))
10011001 return
10021002 }
10031003 }
10041004 // Transaction is in the future queue
10051005 if future := pool .queue [addr ]; future != nil {
10061006 if removed , _ := future .Remove (tx ); removed {
10071007 // Reduce the queued counter
1008- queuedCounter .Dec (1 )
1008+ queuedGauge .Dec (1 )
10091009 }
10101010 if future .Empty () {
10111011 delete (pool .queue , addr )
@@ -1313,7 +1313,7 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Trans
13131313 promoted = append (promoted , tx )
13141314 }
13151315 }
1316- queuedCounter .Dec (int64 (len (readies )))
1316+ queuedGauge .Dec (int64 (len (readies )))
13171317
13181318 // Drop all transactions over the allowed limit
13191319 var caps types.Transactions
@@ -1328,9 +1328,9 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Trans
13281328 }
13291329 // Mark all the items dropped as removed
13301330 pool .priced .Removed (len (forwards ) + len (drops ) + len (caps ))
1331- queuedCounter .Dec (int64 (len (forwards ) + len (drops ) + len (caps )))
1331+ queuedGauge .Dec (int64 (len (forwards ) + len (drops ) + len (caps )))
13321332 if pool .locals .contains (addr ) {
1333- localCounter .Dec (int64 (len (forwards ) + len (drops ) + len (caps )))
1333+ localGauge .Dec (int64 (len (forwards ) + len (drops ) + len (caps )))
13341334 }
13351335 // Delete the entire queue entry if it became empty.
13361336 if list .Empty () {
@@ -1389,9 +1389,9 @@ func (pool *TxPool) truncatePending() {
13891389 log .Trace ("Removed fairness-exceeding pending transaction" , "hash" , hash )
13901390 }
13911391 pool .priced .Removed (len (caps ))
1392- pendingCounter .Dec (int64 (len (caps )))
1392+ pendingGauge .Dec (int64 (len (caps )))
13931393 if pool .locals .contains (offenders [i ]) {
1394- localCounter .Dec (int64 (len (caps )))
1394+ localGauge .Dec (int64 (len (caps )))
13951395 }
13961396 pending --
13971397 }
@@ -1416,9 +1416,9 @@ func (pool *TxPool) truncatePending() {
14161416 log .Trace ("Removed fairness-exceeding pending transaction" , "hash" , hash )
14171417 }
14181418 pool .priced .Removed (len (caps ))
1419- pendingCounter .Dec (int64 (len (caps )))
1419+ pendingGauge .Dec (int64 (len (caps )))
14201420 if pool .locals .contains (addr ) {
1421- localCounter .Dec (int64 (len (caps )))
1421+ localGauge .Dec (int64 (len (caps )))
14221422 }
14231423 pending --
14241424 }
@@ -1506,9 +1506,9 @@ func (pool *TxPool) demoteUnexecutables() {
15061506 log .Trace ("Demoting pending transaction" , "hash" , hash )
15071507 pool .enqueueTx (hash , tx )
15081508 }
1509- pendingCounter .Dec (int64 (len (olds ) + len (drops ) + len (invalids )))
1509+ pendingGauge .Dec (int64 (len (olds ) + len (drops ) + len (invalids )))
15101510 if pool .locals .contains (addr ) {
1511- localCounter .Dec (int64 (len (olds ) + len (drops ) + len (invalids )))
1511+ localGauge .Dec (int64 (len (olds ) + len (drops ) + len (invalids )))
15121512 }
15131513 // If there's a gap in front, alert (should never happen) and postpone all transactions
15141514 if list .Len () > 0 && list .txs .Get (nonce ) == nil {
@@ -1518,7 +1518,7 @@ func (pool *TxPool) demoteUnexecutables() {
15181518 log .Warn ("Demoting invalidated transaction" , "hash" , hash )
15191519 pool .enqueueTx (hash , tx )
15201520 }
1521- pendingCounter .Dec (int64 (len (gapped )))
1521+ pendingGauge .Dec (int64 (len (gapped )))
15221522 }
15231523 // Delete the entire queue entry if it became empty.
15241524 if list .Empty () {
0 commit comments