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