From 38635b53ea61a7cbf98c7ae5b207685ef8e3f936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hampus=20Sj=C3=B6berg?= Date: Tue, 4 May 2021 11:36:22 +0200 Subject: [PATCH] Revert "miner: Use existing helper for total signalling percentage" This reverts commit a52d8fa2d59f2ad6baa624a37480f790cbdcb429. --- frontend/pages/miners.tsx | 7 +++++-- txt/index.ts | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/pages/miners.tsx b/frontend/pages/miners.tsx index 8143fcb..6990866 100644 --- a/frontend/pages/miners.tsx +++ b/frontend/pages/miners.tsx @@ -79,8 +79,11 @@ const Totals = styled.div` export default function Miners() { const blocks = useStoreState((store) => store.blocks); const forkName = config.fork.name; - const { currentNumberOfBlocks, currentSignallingPercentage } = computeStats(blocks); + const { currentNumberOfBlocks } = computeStats(blocks); const miners = useMemo(() => computeMiners(blocks), [blocks]); + const totalSignalling = miners + .filter(([_, m]) => m.signals) + .reduce((sum, [_, m]) => sum + m.numBlocks / currentNumberOfBlocks, 0); return ( @@ -91,7 +94,7 @@ export default function Miners() { - Current total: {currentSignallingPercentage}% <>✅ + Current total: {(totalSignalling * 100).toFixed(2)}% <>✅ diff --git a/txt/index.ts b/txt/index.ts index e422762..f9f75d1 100644 --- a/txt/index.ts +++ b/txt/index.ts @@ -24,6 +24,10 @@ export function homeTXT() { const miners = computeMiners(blocks); const forkName = config.fork.name; + const totalSignalling = miners + .filter(([_, m]) => m.signals) + .reduce((sum, [_, m]) => sum + m.numBlocks / currentNumberOfBlocks, 0); + let blocksTable = ""; blocksTable += `${blocks[0].height}`; for (let i = 0; i < blocks.length; i++) { @@ -89,7 +93,7 @@ ${blocksTable} Miners -Current total: ${currentSignallingPercentage}% ✅ +Current total: ${(totalSignalling * 100).toFixed(2)}% ✅ ${miners .map(