From 10b11d29aec29d5bf7551f3b5af3bf7abda6ffa4 Mon Sep 17 00:00:00 2001 From: ssmithx Date: Wed, 9 Sep 2026 13:58:19 +0000 Subject: [PATCH] fix(cuprate-ui): target_height 0 means synced, not stuck (review) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Monero's get_info returns target_height == 0 when the node is FULLY SYNCED — the field is the height being caught up to, not the chain tip. The '??' fallback left 0 in place, so every healthy node rendered "Syncing — 0.00%, 0 blocks behind" forever. Treat 0/absent as target = own height, the same sentinel electrs_status.rs branches on. --- docker/cuprate-ui/index.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker/cuprate-ui/index.html b/docker/cuprate-ui/index.html index 4b110574..879fb8e1 100644 --- a/docker/cuprate-ui/index.html +++ b/docker/cuprate-ui/index.html @@ -249,7 +249,14 @@ function render(info, heightFallback) { const height = info.height ?? heightFallback ?? 0; - const target = info.target_height ?? info.target ?? height; + // Monero's get_info returns target_height == 0 when the node is + // FULLY SYNCED — the field is the height being caught up to, not + // the chain tip, so `??` cannot substitute for the 0 case (a + // synced node would sit forever at "Syncing — 0.00%"). Treat + // 0/absent as "target is our own height" — the same sentinel + // core/archipelago/src/electrs_status.rs branches on. + const rawTarget = info.target_height ?? info.target ?? 0; + const target = rawTarget > 0 ? rawTarget : height; document.getElementById('height').textContent = tabular(height); document.getElementById('targetOf').textContent = `of ${tabular(target)}`;