Browse Source
miner: Use existing helper for total signalling percentage
master
tomat
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
10 deletions
-
frontend/pages/miners.tsx
-
txt/index.ts
|
|
@ -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> |
|
|
|
|
|
@ -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( |
|
|
|