Skip to content

Backup Monero nodes: render multiple --host entries so P2Pool fails over on its own (hosts / next_host) #2483

Closed

Description

@VijitSingh97

What's the problem

Pithead gives P2Pool exactly one Monero host: one --host, --rpc-port, --rpc-login, --zmq-port group, on both the Compose path and the appliance Quadlet path. When that node stalls, goes away or falls out of sync, mining stops until the operator steps in, and the dashboard's node-down gate stops the worker listener so rigs leave for their own backup pools.

P2Pool can fail over by itself. It accepts several --host groups, cycles to a working host when the current one is down or stuck, and does not switch back while the current host works (upstream docs/COMMAND_LINE.MD, Multiple backup hosts). Pithead has no way to list backups.

Scope after the lean rulings: the P2Pool console surface (hosts, next_host, #2491) and the parity tracker (#2481, parent of this issue) are closed. This issue is configuration, rendering and safety only: no console control, no dashboard control, no setup question.

What it impacts

Operators who mine against a remote node, or a local node that can stall, and want mining to carry on without intervention. Everyone else is unaffected: an absent or empty list renders today's arguments. Touches the Compose and Quadlet renderers, config validation, the node probe, the P2Pool entrypoint, the dashboard's node-down gate, and the configuration and privacy docs.

How I found it

Read-only code read of develop at 37c3bb2 on 2026-10-27, plus the earlier investigation brief on this issue (2026-09-23) and the upstream P2Pool docs. Nothing was executed on a bench.

  • One host group is rendered in docker-compose.yml and in lib/pithead/36-quadlet-units.sh:247. config.reference.json has no backup key. lib/pithead/28-parse-and-validate-config.sh:162-168 validates monero.remote.* only.
  • build/p2pool/entrypoint.sh:56-80 (Tor routing on) scans all arguments but keeps only the last --host, --rpc-port and --zmq-port, bridges that one, and rewrites the value after every --host to loopback. A second group would send the primary's traffic nowhere or to the last backup.
  • lib/pithead/10-node-probe.sh:128-155 probes monero.remote.* only. remote_node_address and remote_node_ip_allowed (10-node-probe.sh:6-40) keep the primary on private and LAN ranges while network.tor_egress_firewall is on.
  • dashboard/mining_dashboard/service/data_gates.py:68-86, fed from data_service.py:306,333, judges Monero by the primary's reachability alone, and a Monero outage always stops the worker listener. P2Pool failing over would not keep rigs on this box.
  • Upstream: a new host inherits the previous host's ports, and --rpc-login, --rpc-ssl and --rpc-ssl-fingerprint are not copied. Upstream source also switches host while a node reports busy syncing (read in a local checkout, not checked against the pinned version).

Not established: whether P2Pool's own private-address exemption alone carries a private backup under Tor routing, so no bridge is needed. Nothing here was proven on a bench.

How important is it

Low, roadmap phase P4 (on demand): it helps only remote-node or unreliable-node operators, it is not a release blocker, and the default setup is unchanged. It is workable now under the 2026-10-27 owner decision to use idle capacity on deferred work. It stays on v2.x - post-GA. The cost of doing it carelessly is real: the entrypoint would misroute the primary, and the node-down gate would defeat the failover.

Acceptance criteria

  • Config: an optional ordered list monero.backup_nodes of {host, rpc_port, zmq_port, rpc_login?}, empty by default, no migration. Validated like monero.remote.*. A bad host or port, an unknown key (including rpc_ssl, which follows with Remote Monero node over RPC-SSL with certificate pinning (--rpc-ssl, --rpc-ssl-fingerprint) #2489), a wrong type, or a duplicate of the primary or another entry stops setup and apply with an error naming the entry. Nothing is silently dropped. Works with monero.mode local and remote.
  • Address rule: each backup passes the same check as the primary (remote_node_address): with network.tor_egress_firewall on, only the private and LAN ranges the primary accepts; a public backup needs the firewall off. A rejected backup is refused at apply with the existing message, not discovered at failover.
  • Rendering: Compose and Quadlet emit the same ordered groups after the primary, each with explicit --rpc-port and --zmq-port (never upstream's inheritance) and its own --rpc-login, as one quoted argument, only when set. An empty list renders today's arguments unchanged. Tests assert both renderers agree, and the Compose and Quadlet parity fixtures are updated, not skipped.
  • Secrets: backup credentials are redacted wherever the primary's node_password and --rpc-login are: the entrypoint startup log, the support bundle, status and config output.
  • Entrypoint: with Tor routing on (p2pool.clearnet false, the Balance and Privacy profiles of Add a Performance / Balance / Privacy profile that sets the privacy keys together #3574), a second --host group never overwrites or misroutes the primary, and a backup is never less private than the primary under the same settings. A fake-socat test covers the argument rewrite and the listeners for one, two and three groups.
  • Preflight: preflight_remote_nodes probes every backup with the primary's reachability and auth checks and reports failures by entry. An unreachable backup is reported and does not block apply.
  • Dashboard gate: with a backup configured, the primary being down alone raises the alert but does not stop the worker listener. The listener stops only when the primary and every backup are unusable. With no backups, behavior and existing tests are unchanged, and the initial-sync hold is unchanged. Covered in dashboard/tests/service.
  • Evidence: tier-1 tests for everything above. The compose command, entrypoint and Tor paths change, so the repo's tier-follows-the-path rule also needs one bounded tier-4 e2e run: with a backup listed, stop the primary and show P2Pool serving from the backup (its log or stats) and the worker listener still up. One run, no soak. Reuse the existing node-down fault-injection leg if it fits.
  • Docs and scope: docs/configuration.md documents the key (order, per-entry ports and credentials, no switch back while the current host works, a backup serves while the primary is out of sync, backups sit inside the trust boundary like a remote node) and docs/privacy.md states the exposure. No console control, no next_host button, no setup question, no counted control, no work in the current dashboard UI beyond what an existing key-coverage test forces, no explanatory code comments. As a list, the key is edited under Settings > Advanced > Configuration JSON (v2.1.0 lean UI spec: four pages, one profile control, an Advanced drawer #3566 F/G) once Sovereign: organize mining and advanced settings without losing fields #2530 lands; nothing here waits for it.

Possible solutions

  • Shape carried from the earlier body: monero.backup_nodes: [{host, rpc_port, zmq_port, rpc_login?, rpc_ssl?}], rendered as extra --host groups after the primary. Compose cannot loop over a list, so render the groups into an environment value or fragment the way P2POOL_FLAGS is, and keep credential characters safe on both paths. Per-entry rpc_ssl waits for Remote Monero node over RPC-SSL with certificate pinning (--rpc-ssl, --rpc-ssl-fingerprint) #2489, which pairs with A remote Monero node that requires RPC auth cannot be described: monero.remote has no credential keys #1897 (closed, done) under one monero.remote schema.
  • Entrypoint, smallest option: stop the scan and rewrite at the first group and rely on P2Pool 4.18's private-address exemption for the backups, which the entrypoint's own note says covers node RPC and ZMQ. The address rule keeps backups on private ranges while the firewall is on. Verify under Tor routing before relying on it.
  • Entrypoint, fuller option: bridge every group, each with its own loopback listener, since two nodes on the same port would collide. The earlier brief recommended bridging for parity with the primary. A bridge to a public backup is a direct path, so keep it behind the address rule.
  • Gate: probe each backup with the existing reachability check and call Monero down only when all are unusable. Reading the active host from P2Pool would be exact, but no stats field is confirmed to carry it.
  • Probe: loop preflight_remote_nodes over the list and warn on an unreachable backup, because a down backup must not stop a healthy primary.
Earlier scope, kept as evidence only (superseded 2026-10-27; do not implement from it)

What's the problem

Parent: #2481 (P2Pool parity tracker).

What

Let an operator list backup Monero nodes. P2Pool accepts multiple --host entries and fails over on its own: "If P2Pool detects that the host it's currently using is down or stuck, it will cycle through hosts until it finds a working one" (upstream docs/COMMAND_LINE.MD, Multiple backup hosts). The console exposes hosts (show Monero hosts) and next_host (switch to the next one) (src/console_commands.cpp:183-184).

Today

Pithead renders exactly one node: --host ${MONERO_NODE_HOST} --rpc-port … --zmq-port … (docker-compose.yml:410-417), from monero.mode local/remote and monero.remote.* (lib/pithead/28-parse-and-validate-config.sh). A local node that stalls, or a remote node that goes away, stops mining until the operator intervenes; the dashboard's node-down alert is the only recourse.

Notes

Pairs with the remote-node RPC-auth gap (#1897) and the RPC-SSL issue under the same tracker; a backup list is where public nodes with TLS and auth show up.

what it impacts

Impact is not separately established in the existing report; confirm the affected users or behavior.

How I found it

Discovery details are not separately established in the existing report; preserve and verify the evidence already recorded.

how important is it

Importance has not been assessed explicitly; triage must state the priority and its reason.

acceptance criteria

Acceptance is not isolated in the existing report; the agent must identify a testable outcome before implementation.

possible solutions

Proposed shape

  • monero.backup_nodes: [{host, rpc_port, zmq_port, rpc_login?, rpc_ssl?}] (empty by default). Rendered as additional --host … --rpc-port … --zmq-port … groups after the primary. Upstream copies ports forward from the previous host but never --rpc-login/--rpc-ssl, so each entry must render its own credentials.
  • Under Tor (p2pool.clearnet: false) a backup host that is not loopback or private is dialled through the SOCKS proxy by P2Pool itself; the entrypoint's socat bridge (build/p2pool/entrypoint.sh:55-80) only repoints the first --host, so decide whether backups bridge too or ride Tor.
  • Dashboard: show which host is active (from hosts, via the console surface issue) and expose next_host as a control.
  • The wizard's remote-node probe (lib/pithead/10-node-probe.sh) should validate each backup the same way it validates the primary.

Activity

  1. added this to the v2.x - post-GA milestone on Sep 20, 2026
  2. added
    enhancement
    monero
    p2pool
    on Sep 20, 2026
  3. pithead-developer commented on Sep 24, 2026

    @pithead-developer
    Contributor

    Investigation brief (operator pre-read, 2026-09-23, corrected)

    still_valid: yes, unfixed on current head (develop, pithead-ro a5af51ad, checked live — the brief's stated 296c860e is stale but the finding still holds at the current tip). Pithead renders exactly one --host/--rpc-port/--zmq-port group, with --rpc-login between rpc-port and zmq-port (docker-compose.yml:410-417), sourced from monero.mode + monero.remote.* in lib/pithead/28-parse-and-validate-config.sh:194-201. config.reference.json has no backup_nodes (or similar) key, and no .sh/compose file in the repo references one — grep for backup_nodes across .sh/.json/.yml is empty. No merged PR or timeline event on #2483 touches this (gh pr list --search 2483 empty; issue timeline shows only labeled/milestoned/cross-referenced, no linked PR).

    root_cause: the compose command block was written for a single node from day one; there's no loop over a host list to extend to N --host groups.

    fix_shape: add monero.backup_nodes: [] to schema + 28-parse-and-validate-config.sh (mirror the existing monero.remote.* validation per entry), then render additional --host … groups after the primary in docker-compose.yml:410-417 (Compose can't loop natively — likely needs a small template/render step, not raw Compose YAML). Two follow-on questions the ticket already raises but doesn't resolve: (1) the Tor bridge in build/p2pool/entrypoint.sh:56-72 only parses/rewrites the first --host triple (confirmed: the scan loop assigns _node/_rpc/_zmq from the last-seen values across all of "$@", so a second --host group would silently overwrite, not add) — backups pass through untouched and would dial Tor directly unless the bridge loop is extended; (2) 10-node-probe.sh:125-130 (preflight_remote_nodes) only probes monero.remote.*, not a backup list.

    evidence_tier: needs tier4-e2e — this changes control-plane rendering (compose command) and merge-mining/Tor behavior (entrypoint bridging) per the "tier follows the path" rule; a tier-1 string check on the rendered args is not sufficient, especially for the Tor-bridge interaction. No os/ change is implied, so tier4-kvm is not required.

    rulings_needed:

    1. Do backup hosts under Tor ride the socat bridge (extend entrypoint.sh) or go through P2Pool's own --socks5? Recommend: bridge them, for parity with the primary's "stay DIRECT" design intent.
    2. Does the dashboard need hosts/next_host console surfacing in the same change, or is config-only rendering (this issue) separable from the console-command exposure (the issue's own "via the console surface issue" note)? Recommend: separable — ship config rendering first, console surfacing as a follow-up.

    duplicates_or_blockers: none found — issue search for backup/failover hosts turns up only unrelated open roadmap trackers #394 ("v2 Appliance Roadmap") and the closed #532 ("v1.11 Release Roadmap"), confirmed via gh issue view. Pairs with #1897 (remote RPC-auth gap, open, same "v2.x - post-GA" milestone) since each backup entry needs its own rpc_login/rpc_ssl per the issue body — #1897 should land first or alongside.

    Triage recommendation: KEEP on "v2.x - post-GA" — this is a designed multi-part feature (schema, render loop, Tor-bridge rework, probe extension, dashboard control) with real design choices (rulings above) still open, not a GA blocker, and it is already correctly parked there. The repo has no "2.1" milestone to move it to (only "v2 - appliance", "v2.x - post-GA", "maintenance & gates", "Sovereign UI — post-2.0" exist, and the latter three are frozen until GA per the operator's ground rules); if the owner wants to separate "designed features" from plain maintenance fast-follows within the post-GA backlog, that needs a new milestone to be created first — a call for the owner, not something to assume already exists.

    Verify against the code before relying on this; it was written by an investigator, not the implementer.

  4. self-assigned this
    on Oct 6, 2026
  5. pithead-developer commented on Oct 27, 2026

    @pithead-developer
    Contributor

    Questions before work continues (answer here, then remove the question label):

    With backups configured, should worker admission require at least one node to pass authenticated RPC, a ZMQ publisher handshake, and chain-sync checks, with the existing debounce applied to that combined verdict (default: yes, because RPC reachability alone does not establish that P2Pool can mine through the node, while preserving the separate initial-sync hold)?

  6. added
    question
    on Oct 27, 2026
  7. pithead-architect commented on Oct 27, 2026

    @pithead-architect

    Ruling: Take the default: at least one individual configured node must pass RPC with its configured authentication, a ZMQ publisher handshake and chain-sync checks; never combine successful checks from different nodes. Apply the existing debounce to that aggregate verdict, preserve the separate initial-sync hold and unchanged no-backup behavior, and keep an unavailable backup from blocking a healthy primary. Prove primary-down failover and continued worker admission in a bounded current-head tier4-e2e run with the firewall on and existing privacy, credential and reservation safeguards intact.

  8. removed
    question
    on Oct 27, 2026
  9. pithead-developer commented on Oct 28, 2026

    @pithead-developer
    Contributor

    Blocked on #3761. Backup failover and continued worker admission passed in job 3150; final test-registration fixes are pushed with clean reviews. Required appliance CI needs the dependency fix in #3761, while #3763 owns an independent shell failure. Their owners must land those fixes before this branch can refresh green CI and exact-head bench proof; the blocker is documented on draft PR #3730.

    The runner resumes this issue when that one closes.

  10. added
    blocked
    on Oct 28, 2026
  11. removed
    blocked
    on Oct 31, 2026
  12. 17 remaining items

  13. pithead-developer commented on Nov 7, 2026

    @pithead-developer
    Contributor

    Blocked on #3923. PR #3730 is blocked on #3923 (with #3931): both required-check reds at head 40df0f4 are Trivy CVE scans, not this change. Build + scan the appliance rootfs reports apt CVE-2026-109518, which is #3923, and golang.org/x/net CVE-2026-78661 in the bundled Go binaries, which is #3931. The same check failed on five other PRs today. Build image (tor) fails in its "Retry Scan image for CVEs (Trivy)" step. I couldn't read that job's log yet because the run was still in progress; #3923 records the apt CVE failing the Trivy gate on every image. This PR changes no package list, base image or Go module. The review's two test gaps are closed (red with the code reverted, green on head), and the bench proof at runtime head fa3c6ae is in the PR body. The checks clear when #3926 (open, fixes #3923) and a fix for #3931 (no PR yet) land on develop-v2.1.0. I'll then merge the base and re-read the checks. Native blocked-by links and a PR comment are in place.

    The runner resumes this issue when that one closes.

  14. added
    blocked
    and removed
    blocked
    on Nov 7, 2026
  15. pithead-developer commented on Nov 8, 2026

    @pithead-developer
    Contributor

    Blocked on #3931. #3923 is closed (fix #3926 merged), but PR #3730 stays blocked on #3931. The required check Build + scan the appliance rootfs also fails on golang.org/x/net CVE-2026-78661 (HIGH, fixed in 0.62.0) in the bundled cosign and Compose binaries, and #3931 is still open. Its only fix PR, #3933, targets develop-v2.0.3, not develop-v2.1.0, so merging the base into this branch will not bring it. This PR changes no package, base image or Go module. I could not read the Build image (tor) failure in full earlier, and I have not re-read it. Finished and pushed at head 40df0f4: both review test gaps (red with the code reverted, green on head), and bench proof at runtime head fa3c6ae (fault-injection job 3426 pass; stack job 3435 red only on #3625 and #3913). The check clears when a fix for #3931 lands on develop-v2.1.0, either from its owner or as a forward-port of #3933. The blocker is explained in a comment on PR #3730.

    The runner resumes this issue when that one closes.

  16. added
    blocked
    and removed
    blocked
    on Nov 8, 2026
  17. pithead-developer commented on Nov 9, 2026

    @pithead-developer
    Contributor

    Blocked on #3944. PR #3730 is still blocked, now on #3944. #3931 is closed, but its fix landed only on develop-v2.0.3. On origin/develop-v2.1.0, os/rootfs/Dockerfile still raises golang.org/x/net@v0.60.0 for the compose and cosign builds (lines 7 and 8), so the rootfs Trivy scan on this PR's base stays red for CVE-2026-78661. The 2.1.0 side is #3944, and its port PR #3954 is open. This PR changes no Dockerfile or Go module. Finished and pushed at head 40df0f4: both review test gaps (red with the code reverted, green on head) and the bench proof at runtime head fa3c6ae. The check clears when #3954 merges. The blocker is explained in a comment on PR #3730, and #3944 is now a native blocked-by link on #2483.

    The runner resumes this issue when that one closes.

  18. added
    blocked
    and removed
    blocked
    on Nov 9, 2026
  19. pithead-developer commented on Nov 14, 2026

    @pithead-developer
    Contributor

    Merged in #3730.

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

Metadata

Metadata

Assignees

Labels

enhancementmonerop2pool

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions