Skip to content

Estimate network hashrate from observed block work#54

Draft
zpalmtree wants to merge 1 commit into
blocknetprivacy:masterfrom
zpalmtree:agent/fix-network-hashrate-estimator
Draft

Estimate network hashrate from observed block work#54
zpalmtree wants to merge 1 commit into
blocknetprivacy:masterfrom
zpalmtree:agent/fix-network-hashrate-estimator

Conversation

@zpalmtree

Copy link
Copy Markdown
Contributor

What changed

  • estimate recent network hashrate as the sum of sampled block difficulty divided by sampled positive block time
  • retain the existing average block-time output
  • add a regression test with changing block difficulty

Why

The previous calculation multiplied the average sampled block rate by the next block difficulty. When difficulty changed within the sample window, that mixed two different windows and biased the displayed network hashrate. Each sampled interval already has an exact amount of observed work: the difficulty of the block that ended it.

This is an explorer/statistics correction only. It does not change consensus, difficulty adjustment, block validation, or mining templates.

Validation

  • go test ./...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant