Browse Source

miner: Use existing helper for total signalling percentage

master
tomat 4 years ago
committed by GitHub
parent
commit
a52d8fa2d5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      frontend/pages/miners.tsx
  2. 6
      txt/index.ts

7
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 (
<Container>
@ -94,7 +91,7 @@ export default function Miners() {
<SiteTitle />
<SiteMenu />
<Totals>
Current total: {(totalSignalling * 100).toFixed(2)}% <></>
Current total: {currentSignallingPercentage}% <></>
</Totals>
<Table>
<TableHead>

6
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(

Loading…
Cancel
Save