From 48c541c8efabaabb8899c3d337a58547cc9a5783 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 22 Nov 2023 17:46:14 -0500 Subject: [PATCH] Fix P-chain mempool tx count metric (#2361) --- vms/platformvm/txs/mempool/mempool.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vms/platformvm/txs/mempool/mempool.go b/vms/platformvm/txs/mempool/mempool.go index e7a2018b7e71..675ec3c5c763 100644 --- a/vms/platformvm/txs/mempool/mempool.go +++ b/vms/platformvm/txs/mempool/mempool.go @@ -192,6 +192,7 @@ func (m *mempool) Add(tx *txs.Tx) error { } m.unissuedTxs.Put(tx.ID(), tx) + m.numTxs.Inc() m.bytesAvailable -= txSize m.bytesAvailableMetric.Set(float64(m.bytesAvailable)) @@ -220,12 +221,11 @@ func (m *mempool) Remove(txsToRemove []*txs.Tx) { if !m.unissuedTxs.Delete(txID) { continue } + m.numTxs.Dec() m.bytesAvailable += len(tx.Bytes()) m.bytesAvailableMetric.Set(float64(m.bytesAvailable)) - m.numTxs.Dec() - inputs := tx.Unsigned.InputIDs() m.consumedUTXOs.Difference(inputs) }