@@ -134,6 +134,9 @@ var (
134134
135135 slotsGauge = metrics .NewRegisteredGauge ("txpool/slots" , nil )
136136
137+ pendingAddrsGauge = metrics .NewRegisteredGauge ("txpool/pending/accounts" , nil )
138+ queuedAddrsGauge = metrics .NewRegisteredGauge ("txpool/queued/accounts" , nil )
139+
137140 reheapTimer = metrics .NewRegisteredTimer ("txpool/reheap" , nil )
138141)
139142
@@ -863,6 +866,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
863866 // Try to insert the transaction into the pending queue
864867 if pool .pending [addr ] == nil {
865868 pool .pending [addr ] = newList (true )
869+ pendingAddrsGauge .Inc (1 )
866870 }
867871 list := pool .pending [addr ]
868872
@@ -1073,6 +1077,7 @@ func (pool *TxPool) removeTx(hash common.Hash, outofbound bool, unreserve bool)
10731077 // If no more pending transactions are left, remove the list
10741078 if pending .Empty () {
10751079 delete (pool .pending , addr )
1080+ pendingAddrsGauge .Dec (1 )
10761081 }
10771082 // Postpone any invalidated transactions
10781083 for _ , tx := range invalids {
@@ -1365,6 +1370,9 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
13651370 pool .currentState = statedb
13661371 pool .pendingNonces = newNoncer (statedb )
13671372
1373+ pendingAddrsGauge .Update (0 )
1374+ queuedAddrsGauge .Update (0 )
1375+
13681376 // Inject any transactions discarded due to reorgs
13691377 log .Debug ("Reinjecting stale transactions" , "count" , len (reinject ))
13701378 core .SenderCacher .Recover (pool .signer , reinject )
@@ -1568,6 +1576,7 @@ func (pool *TxPool) demoteUnexecutables() {
15681576 // Delete the entire pending entry if it became empty.
15691577 if list .Empty () {
15701578 delete (pool .pending , addr )
1579+ pendingAddrsGauge .Dec (1 )
15711580 if _ , ok := pool .queue .get (addr ); ! ok {
15721581 pool .reserver .Release (addr )
15731582 }
0 commit comments