Repository navigation
Description
Affected layers
- Backend (
server/): affected.checkBitcoinCoreVersioninserver/src/bitcoin-core-version.tsanswersnode-unavailablewhen the version read fails and its own probe of the IPC socket fails too.reconcileBitcoinCoreVersioninserver/src/auto-start.tstakes 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/configandPOST /api/restartinserver/src/index.ts, refuse to start onnode-unavailableand 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
- docker: JDC runs only with the Bitcoin Core version of the node it connects to #399, closed by fix: keep JDC on the node's Bitcoin Core version #400, asks that a JD stack never keeps running with a version that differs from the node's; this path breaks that after a node restart.
- fix: keep JDC on the node's Bitcoin Core version #400 added the version check and the reconciler's handling of it; it shipped in v0.8.1 and v0.8.2.
- Tracker: [Tracker] Docker orchestration and generated configs #371.
Activity