Repository navigation
Description
What's the problem
Part of #2476. Owner priority (2026-10-27): build the opt-in donation feature now, shipping dark. This is the feature itself: sending a slice of each cycle to the project endpoint. AlgoService is the only writer of the proxy's pool list, and any second writer would race it (both do GET, modify, PUT on /1/config, dashboard/mining_dashboard/client/xmrig_proxy_client.py:120-184). Today it knows two pools:
switch_minersbuilds a P2Pool pool and an XvB pool, puts the enabled one first, and sends both (dashboard/mining_dashboard/service/xvb/algo_service.py:75-115); only the XvB pool carriessocks5(:89-91).runexecutesP2POOL,XVBorSPLITwith inline sleeps (:483-558). With XvB off,get_decisionreturnsP2POOLat once (:142-143) and the loop still runs, so a project slice must work with XvB off.- The mode label is read by substring:
"XVB" in current_modedecides hashrate attribution (service/data_service.py:188-190, :508-510) and the chart palette checksSplitandXVB(web/views/series_views.py:193-200).
Wire the planner ({{A3}}), the constants loader ({{A2}}), the config ({{A1}}) and the store ({{A4}}) into the controller:
- A third pool object for the project:
urlis the constants endpoint,useris one fixed non-identifying label (never the wallet, the XvB donor id or a rig name; printable ASCII without.or+, because upstream P2Pool splits the login on those characters,src/stratum_server.cpp:204-262),passx,coinmonero,socks5set only whenDONATION_TOR_ENABLED; the local P2Pool pool never getssocks5. runasks the planner for segments (XvB slice, P2Pool remainder, project slice), sleeps each segment's length, and switches to the project pool for the last one. The project slice uses a plain sleep like the XvB slice (:539), the P2Pool remainder keeps_smart_sleep.max_fractioncomes from the same_max_donation_fractionhelper (:286-294,steering_projection.py:35-53), computed inrunbecauseget_decisionreturns before computing it when XvB is off.- While workers are rejected (
:495) nothing is switched and the debt is untouched. - The project mode label contains neither
XVBnorSplit. - Every cycle the controller records a
donation_historyrow and the state record from {{A4}}, so a dashboard restart resumes the debt. algo_service.pyis at its 558-line ceiling indocs/dev/file-budget.tsv. Move the pool-building and the segment executor into new files underservice/donation/(for examplepools.py,executor.py) first, so the net change toalgo_service.pyis zero or negative.
What it impacts
The proxy's upstream route for every opted-in operator, and the XvB controller's path (shared run loop). With the feature disabled or unavailable the payloads must not change.
How I found it
Read-only scan of origin/develop-v2.1.0 at 02852bd on 2026-10-27 from the paths above and dashboard/tests/service/xvb/test_algo_service_switch_miners.py:1-52 (the existing pool tests). Nothing was executed. Unknown: whether xmrig-proxy honours socks5 for an onion upstream (the e2e phase proves it), and whether a project slice should be skipped while the donor has no share in the PPLNS window (algo_service.py:153-157 forces P2Pool for XvB then). This issue does not skip it; an owner ruling would be a small follow-up.
How important is it
High inside this lane. It touches real hashpower routing, so default-off and fail-safe behavior carry the weight.
Acceptance criteria
- With the feature disabled or
donation.jsonempty,switch_minerssends byte-identical payloads to today forP2POOL,XVBandSPLIT, and the existing tests intest_algo_service_switch_miners.pypass unchanged. A new parity test pins the two-pool payloads. - Enabled and available: the pool list has three entries and exactly one is enabled; the project pool matches the shape above; a test asserts the serialized payload contains neither
MONERO_WALLET_ADDRESSnorXVB_DONOR_IDin the project entry and that the label has no.or+;socks5appears only on the XvB pool (whenxvb.tor) and the project pool (whendonation.tor), mirroringtest_algo_service_switch_miners.py:20-52. - With a fake clock: XvB off gives P2Pool then project;
SPLITgives XvB slice, P2Pool remainder, project slice; the sleep lengths equal the planner's segments; the XvB slice length is identical with and without the donation enabled. - A planner trim sets
status: reducedandreduced_percentin the state record, and a slice start setsslice_ends_at(cleared when it ends);workers_rejectedblocks switching and keeps the debt; the project label contains neitherXVBnorSplit, and the attribution and palette tests keep passing. - One
donation_historyrow per cycle, and a restarted controller resumes the stored debt. algo_service.pyhas no more lines than before; new logic is underservice/donation/.make test,make test-patch-coverage(90 % of changed lines) andmake lint-file-budgetpass. No new explanatory code comments.- This PR changes no
docker-compose.yml,build/oros/path, so notier4job is required to merge. The live proof is the--donation-routing-smokephase ({{A12}}), which must pass against this change before the setting is ever shown to users.
Possible solutions
- Planner-driven loop in a new executor module with
runcalling it only when the feature is active (recommended: the old path stays byte-identical). - Make the existing three-way decision a list of segments for every user: one code path, but every XvB user's behavior changes and needs re-proving.
- Skip the project slice while no PPLNS share is in the window, as XvB does: protects share finding for tiny miners, and a tiny miner may then never donate.
Part of #2476. Depends on {{A1}}, {{A2}}, {{A3}} and {{A4}}.
Activity
pithead-developer commentedon Nov 16, 2026
Blocked on #3695.
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.pithead-architect commentedon Nov 20, 2026
Owner ruling, 2026-11-20: "we can dark release it ahead so we can spot issues in logs before making a proper ui for it".
The backend ships in v2.0.7 and v2.0.8 with no UI, so the logs are the only way to see it working. One acceptance criterion is added to this issue:
donation:): slice start and end, the route chosen (tor or direct), fallback to P2Pool, endpoint errors and the cost estimate. These lines appear in the dashboard log and in the support bundle, with addresses redacted by the existing redactors. No UI is required.