diff --git a/frontend/src/app/components/acceleration/active-acceleration-box/active-acceleration-box.component.ts b/frontend/src/app/components/acceleration/active-acceleration-box/active-acceleration-box.component.ts index f52c45041..309d2ed1f 100644 --- a/frontend/src/app/components/acceleration/active-acceleration-box/active-acceleration-box.component.ts +++ b/frontend/src/app/components/acceleration/active-acceleration-box/active-acceleration-box.component.ts @@ -78,17 +78,17 @@ export class ActiveAccelerationBox implements OnChanges { if (!pool) { continue; } - totalAcceleratedHashrate += parseFloat(pool.lastEstimatedHashrate); + totalAcceleratedHashrate += pool.lastEstimatedHashrate; } - this.acceleratedByPercentage = ((totalAcceleratedHashrate / parseFloat(this.miningStats.lastEstimatedHashrate)) * 100).toFixed(1) + '%'; + this.acceleratedByPercentage = ((totalAcceleratedHashrate / this.miningStats.lastEstimatedHashrate) * 100).toFixed(1) + '%'; data.push(getDataItem( totalAcceleratedHashrate, 'var(--mainnet-alt)', `${this.acceleratedByPercentage} accelerating`, ) as PieSeriesOption); - const notAcceleratedByPercentage = ((1 - (totalAcceleratedHashrate / parseFloat(this.miningStats.lastEstimatedHashrate))) * 100).toFixed(1) + '%'; + const notAcceleratedByPercentage = ((1 - (totalAcceleratedHashrate / this.miningStats.lastEstimatedHashrate)) * 100).toFixed(1) + '%'; data.push(getDataItem( - (parseFloat(this.miningStats.lastEstimatedHashrate) - totalAcceleratedHashrate), + (this.miningStats.lastEstimatedHashrate - totalAcceleratedHashrate), 'rgba(127, 127, 127, 0.3)', `${notAcceleratedByPercentage} not accelerating`, ) as PieSeriesOption); diff --git a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts index 2d78252ef..2e8a820be 100644 --- a/frontend/src/app/components/pool-ranking/pool-ranking.component.ts +++ b/frontend/src/app/components/pool-ranking/pool-ranking.component.ts @@ -163,7 +163,7 @@ export class PoolRankingComponent implements OnInit { const i = pool.blockCount.toString(); if (this.miningWindowPreference === '24h') { return `${pool.name} (${pool.share}%)
` + - pool.lastEstimatedHashrate.toString() + ' ' + miningStats.miningUnits.hashrateUnit + + pool.lastEstimatedHashrate.toFixed(2) + ' ' + miningStats.miningUnits.hashrateUnit + `
` + $localize`${ i }:INTERPOLATION: blocks`; } else { return `${pool.name} (${pool.share}%)
` + @@ -291,7 +291,7 @@ export class PoolRankingComponent implements OnInit { */ getEmptyMiningStat(): MiningStats { return { - lastEstimatedHashrate: 'Error', + lastEstimatedHashrate: 0, blockCount: 0, totalEmptyBlock: 0, totalEmptyBlockRatio: '', diff --git a/frontend/src/app/interfaces/node-api.interface.ts b/frontend/src/app/interfaces/node-api.interface.ts index aee872968..d50d4ba00 100644 --- a/frontend/src/app/interfaces/node-api.interface.ts +++ b/frontend/src/app/interfaces/node-api.interface.ts @@ -140,7 +140,7 @@ export interface SinglePoolStats { emptyBlocks: number; rank: number; share: number; - lastEstimatedHashrate: string; + lastEstimatedHashrate: number; emptyBlockRatio: string; logo: string; slug: string; diff --git a/frontend/src/app/services/mining.service.ts b/frontend/src/app/services/mining.service.ts index 45d2e4ac8..7bbf6b759 100644 --- a/frontend/src/app/services/mining.service.ts +++ b/frontend/src/app/services/mining.service.ts @@ -12,7 +12,7 @@ export interface MiningUnits { } export interface MiningStats { - lastEstimatedHashrate: string; + lastEstimatedHashrate: number; blockCount: number; totalEmptyBlock: number; totalEmptyBlockRatio: string; @@ -111,7 +111,7 @@ export class MiningService { const poolsStats = stats.pools.map((poolStat) => { return { share: parseFloat((poolStat.blockCount / stats.blockCount * 100).toFixed(2)), - lastEstimatedHashrate: (poolStat.blockCount / stats.blockCount * stats.lastEstimatedHashrate / hashrateDivider).toFixed(2), + lastEstimatedHashrate: poolStat.blockCount / stats.blockCount * stats.lastEstimatedHashrate / hashrateDivider, emptyBlockRatio: (poolStat.emptyBlocks / poolStat.blockCount * 100).toFixed(2), logo: `/resources/mining-pools/` + poolStat.slug + '.svg', ...poolStat @@ -119,7 +119,7 @@ export class MiningService { }); return { - lastEstimatedHashrate: (stats.lastEstimatedHashrate / hashrateDivider).toFixed(2), + lastEstimatedHashrate: stats.lastEstimatedHashrate / hashrateDivider, blockCount: stats.blockCount, totalEmptyBlock: totalEmptyBlock, totalEmptyBlockRatio: totalEmptyBlockRatio,