8000 docker: auto-start never runs JDC on a Bitcoin Core version it did not read from the node · Issue #414 · stratum-mining/sv2-ui · GitHub
[go: up one dir, main page]

Skip to content

docker: auto-start never runs JDC on a Bitcoin Core version it did not read from the node #414

Open

Description

@GitGab19

Affected layers

  • Backend (server/): affected. checkBitcoinCoreVersion in server/src/bitcoin-core-version.ts answers node-unavailable when the version read fails and its own probe of the IPC socket fails too. reconcileBitcoinCoreVersion in server/src/auto-start.ts takes that answer as leave to go on with the saved configuration, and leaves the decision to the socket probe that runs later in the same tick. If the socket has come back by then, the stack starts on the saved version although no read succeeded. The reconciler then skips the version check for as long as that JDC stays up: the flag that allows the skip is set by the first successful read after the backend boots and is never cleared, so it also covers a JDC started without a read. The manual paths, POST /api/setup, PUT /api/config and POST /api/restart in server/src/index.ts, refuse to start on node-unavailable and are not affected.
  • Frontend (src/): not affected. It shows what the backend reports.
  • shared/: not affected. It holds the supported versions and the issue codes.
  • The block loss itself comes from JDC's IPC client for one Core major version failing to submit blocks to the other, tracked on the sv2-apps side in consider heuristics for detecting Bitcoin Core version sv2-apps#570. This guarantee needs no sv2-apps change.

Problem

Within one auto-start tick, the version read can fail, then the socket probe inside the version check can fail, and then the socket probe before the start can succeed. This happens when the node's IPC socket comes back in between, as it does while the node restarts, or when a transient Docker failure hits the helper containers both probes run in. JDC is stopped at that moment because the node restarted, and a node changes major version only by restarting, so this is the tick when the saved version is most likely out of date.

Reproduced on main at ed7d84b under Node 24. With the Loupe test, the reconciler starts the stack although every version read failed. A second test with the real reconciler confirms the version at boot, restarts the node, lets the next tick start JDC through this path, and then runs another tick with JDC up: the version is not read again.

Impact

A JDC built for the other Core major version connects and gets templates normally, and fails to submit every block it finds, as #399 describes. Here it stays that way until JDC stops for another reason or SV2 UI restarts, and the dashboard warning for a failed block submission appears only once a block has been lost. No attacker is needed: it takes a node restart into a new major version, such as Umbrel's Bitcoin Node moving latest, with the socket coming back in the second or so between the two probes of one tick. The odds per node upgrade are small, as an estimate rather than a measurement, since ticks are at least 30 seconds apart and at least a minute once a failed tick has started the backoff. One hit costs every block found until the next restart. Loupe rates it medium and expects a later tick to correct the version; the second test shows that does not happen while JDC stays up.

Expected outcome

  • Auto-start never starts a JD stack, and never leaves one running, on a Bitcoin Core version that was not read from the node for that start, whatever order the node's RPC server and IPC socket come back in after a restart.
  • While the node can't be reached, the dashboard reports it as it does today, and mining starts on its own once the version can be read.

Loupe findings

  • project-loupe/audit-sv2-ui#113: a socket that recovers within the tick lets auto-start mine after a failed version read

Related issues and PRs

Activity

  1. added
    area:docker
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:docker

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0