fix(cuprate-ui): target_height 0 means synced, not stuck (review)

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.
This commit is contained in:
2026-09-12 16:14:55 -04:00
committed by archipelago
parent c681472e15
commit 047ef98987
+8 -1
View File
@@ -249,7 +249,14 @@
function render(info, heightFallback) { function render(info, heightFallback) {
const height = info.height ?? heightFallback ?? 0; 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('height').textContent = tabular(height);
document.getElementById('targetOf').textContent = `of ${tabular(target)}`; document.getElementById('targetOf').textContent = `of ${tabular(target)}`;