Repository navigation
Description
What's the problem
Part of #2476. Owner priority (2026-10-27): build the opt-in donation feature now, shipping dark. The first report requires "the expected monthly XMR cost shown before enabling". Nothing computes it. The pieces exist but are not combined:
- The earnings model gives expected XMR per 1 H/s per day from the block reward and network difficulty (
dashboard/mining_dashboard/service/xvb/earnings.py:41, used byweb/views/xvb_views.py:496-564, fieldcoeff_day). - Recorded payouts, when the view-only feature is on, are rolled into totals by
confirmed_payouts_summary(earnings.py:112), including a 30-day figure. - The existing estimate is explicitly P2Pool-only and excludes XvB (
xvb_views.py:505-510), which is the right basis for what a donor gives up.
Add dashboard/mining_dashboard/service/donation/estimate.py and fill the estimate field of the donation state block from {{A4}}:
{"basis": "payouts" | "model" | "unknown", "xmr_month": float | null, "as_of": ts}
payouts: the configured percentage times the last 30 days of recorded payouts, scaled for the share already donated in that period, when a view key is set and at least 30 days of tracking exist.model: the configured percentage times the P2Pool hashrate average timescoeff_daytimes 30, when the network figures are available. The percentage used is the configured one even while the feature is off, so the number is shown before enabling.unknown: neither basis is available;xmr_monthis null. A stale or missing input is never turned into a number.
The model path depends on the dynamic PPLNS window question in #2479; the payload carries basis so the UI can say which one it used.
What it impacts
The settings section's cost line and the Earnings line (UI children). Operators see a number before enabling that is honest about its basis.
How I found it
Read-only scan of origin/develop-v2.1.0 at 02852bd on 2026-10-27 from the paths above. Nothing was executed. Unknown: how accurate the model path is until #2479 lands, and the exact scaling for "share already donated" in the payouts path (the PR states its formula and tests it).
How important is it
Medium. Required by the first report's requirements; low risk because it only reads.
Acceptance criteria
- New
dashboard/tests/service/donation/test_estimate.py: payouts basis with 30 days of rows returns the formula's value; fewer than 30 days or no view key falls to the model; no network figures fall tounknownwithxmr_monthnull; percentages 1, 2, 5 and 10 scale linearly; with the feature off the estimate is still produced. - The state block carries
estimate; itsas_ofequals the newest input timestamp; a stale feed (xvb_stats_are_stale-style staleness) yieldsunknown, not the last value. - The PR states its formulas in
docs/donation.md({{A5}}) in one paragraph and the test pins them. - Reads payouts through the existing accessors and edits no module whose path names payouts or wallets; new code lives under
service/donation/. make test,make test-patch-coverage(90 % of changed lines) andmake lint-file-budgetpass. No new explanatory code comments.
Possible solutions
- Two bases with a tag (recommended: honest, and the payouts path improves as tracking history grows).
- Model only: simpler, but then the estimate inherits any Investigate: P2Pool's PPLNS window is dynamic (2× network-difficulty cap); the dashboard models it as 2160 blocks × nominal block time #2479 error with nothing to cross-check it.
- Show a percentage and minutes per day only, no XMR figure: avoids a wrong number, and drops a stated requirement.
Activity
pithead-developer commentedon Nov 16, 2026
Blocked on #3697.
Dependency marker for the dashboard. The native blocked-by links on this issue already name these open blockers, and the tick removes
blockedwhen every one of them closes.