Skip to content

Commit 4395fd6

Browse files
Melvin Carvalhoclaude
andcommitted
fullnode.html: heartbeat on the Node tab so it's visibly listening
Between blocks the tip card looked frozen. Add a 1s heartbeat: the header-tip subtext now ticks "following the tip · Ns since last block", resetting when a new block arrives. Header lane only; node.html untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 01a1cf8 commit 4395fd6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎fullnode.html‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,18 @@ <h1>bitcoin-kernel / browser-node — toward a full node <span class="dim">(test
132132
$('hsub').textContent = (webrtc ? 'WebRTC' : 'bridge') + ': synced + validated, live';
133133
log(`header tip: #${fmt(tip.height)} (validated from genesis)`, 'ok');
134134
// Keep pace with the tip: poll the peer; validate each new header as testnet4 mines it.
135+
let lastBlockAt = Date.now();
135136
tail(session, { intervalMs: 8000, log, onTip: ({ height, hash, added, reorgs }) => {
137+
lastBlockAt = Date.now();
136138
$('htip').textContent = '#' + fmt(height);
137-
$('hsub').textContent = (webrtc ? 'WebRTC' : 'bridge') + `: following the tip · +${added}`;
138139
log(`new block: header tip → #${fmt(height)} (${hash.slice(0, 16)}…)`, 'ok');
139140
if (reorgs && reorgs.length) log(`reorg handled while following (${reorgs.length})`, 'warn');
140141
} });
142+
// heartbeat: tick every second so it's visibly listening, even between blocks
143+
setInterval(() => {
144+
const s = Math.round((Date.now() - lastBlockAt) / 1000);
145+
$('hsub').textContent = (webrtc ? 'WebRTC' : 'bridge') + `: following the tip · ${s}s since last block`;
146+
}, 1000);
141147
log('following the tip — new headers validate as the network mines them', 'dim');
142148
} catch (e) {
143149
$('htip').textContent = 'offline';

0 commit comments

Comments
 (0)