From eb37929c145ee0ff60a65f21042f43aec87a0781 Mon Sep 17 00:00:00 2001 From: everoddandeven Date: Thu, 31 Oct 2024 21:14:39 +0100 Subject: [PATCH] Fix tx pool stats --- src/app/core/services/daemon/daemon.service.ts | 2 +- .../pages/transactions/transactions.component.html | 5 +++-- src/common/TxPoolStats.ts | 12 ++++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/app/core/services/daemon/daemon.service.ts b/src/app/core/services/daemon/daemon.service.ts index 6848f76..6cdc6d8 100644 --- a/src/app/core/services/daemon/daemon.service.ts +++ b/src/app/core/services/daemon/daemon.service.ts @@ -1098,7 +1098,7 @@ export class DaemonService { throw new Error(response.status); } - return TxPoolStats.parse(response); + return TxPoolStats.parse(response.pool_stats); } public async getTransactionPoolHashes(): Promise { diff --git a/src/app/pages/transactions/transactions.component.html b/src/app/pages/transactions/transactions.component.html index 25b68c0..e38908b 100644 --- a/src/app/pages/transactions/transactions.component.html +++ b/src/app/pages/transactions/transactions.component.html @@ -26,8 +26,8 @@
Bytes
    -
  • Bytes Max: {{ txPoolStats.bytesMax }} bytes
  • -
  • Bytes Med: {{ txPoolStats.bytesMed }} units
  • +
  • Bytes Max: {{ txPoolStats.bytesMax }}
  • +
  • Bytes Med: {{ txPoolStats.bytesMed }}
  • Bytes Min: {{ txPoolStats.bytesMin }}
  • Bytes Total: {{ txPoolStats.bytesTotal }}
@@ -51,6 +51,7 @@
  • Failing transactions: {{ txPoolStats.numFailing }}
  • Non-relayed transactions: {{ txPoolStats.numNotRelayed }}
  • Oldest transaction in the pool: {{ txPoolStats.oldest }}
  • +
  • Fee total: {{ txPoolStats.feeTotalXMR }} XMR
  • Total number of transactions: {{ txPoolStats.txsTotal }}
  • diff --git a/src/common/TxPoolStats.ts b/src/common/TxPoolStats.ts index 4dd4e7f..628f14b 100644 --- a/src/common/TxPoolStats.ts +++ b/src/common/TxPoolStats.ts @@ -16,6 +16,10 @@ export class TxPoolStats { public readonly oldest: number; public readonly txsTotal: number; + public get feeTotalXMR(): number { + return this.feeTotal / 1e12; + } + constructor(bytesMax: number, bytesMed: number, bytesMin: number, bytesTotal: number, feeTotal: number, histo: TxPoolHisto, histo98pc: number, num10m: number, numDoubleSpends: number, numFailing: number, numNotRelayed: number, oldest: number, @@ -41,10 +45,10 @@ export class TxPoolStats { const bytesMed: number = txPoolStats.bytes_med; const bytesMin: number = txPoolStats.bytes_min; const bytesTotal: number = txPoolStats.bytes_total; - const feeTotal: number = txPoolStats.total_fee; - const histo: TxPoolHisto = TxPoolHisto.parse(txPoolStats.histo); - const histo98pc: number = txPoolStats.histo98pc; - const num10m: number = txPoolStats.num10m; + const feeTotal: number = txPoolStats.fee_total; + const histo: TxPoolHisto = txPoolStats.histo ? TxPoolHisto.parse(txPoolStats.histo) : new TxPoolHisto(0, 0); + const histo98pc: number = txPoolStats.histo_98pc; + const num10m: number = txPoolStats.num_10m; const numDoubleSpends: number = txPoolStats.num_double_spends; const numFailing: number = txPoolStats.num_failing; const numNotRelayed: number = txPoolStats.num_not_relayed;