Skip to content

Commit

Permalink
fix: network watt hour calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
mistakia committed Mar 11, 2024
1 parent e15044d commit 2c040aa
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/core/network/selectors.js
Expand Up @@ -12,11 +12,10 @@ export function getNetworkWattHour(state) {
const peers = network.getIn(['stats', 'nanobrowse_monitors'], [])
const prs = peers.filter((p) => p.PR)
let sum = 0
const average_watt_hour = network.get('averageWattHour') || 0
for (const pr of prs) {
sum += accounts.getIn(
[pr.nanoNodeAccount, 'watt_hour'],
network.get('averageWattHour')
)
sum +=
accounts.getIn([pr.nanoNodeAccount, 'watt_hour']) || average_watt_hour
}

return sum
Expand Down

0 comments on commit 2c040aa

Please sign in to comment.