From 512aea96e5f63f7eee5f2c153b5598d993d61399 Mon Sep 17 00:00:00 2001 From: saubyk <39208279+saubyk@users.noreply.github.com> Date: Thu, 16 Jul 2026 22:43:28 -0700 Subject: [PATCH] Coerce mirrored peer_connected to a boolean Address review feedback on #1625: copy peer_connected onto the legacy `connected` field as a real boolean (!!), so strict-equality readers such as onchain.ts's `connected === false` behave correctly when peer_connected is absent, instead of leaving `connected` undefined. Co-Authored-By: Claude Opus 4.8 (1M context) --- server/controllers/cln/channels.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/controllers/cln/channels.ts b/server/controllers/cln/channels.ts index 5ee0f18d..bf3c6166 100644 --- a/server/controllers/cln/channels.ts +++ b/server/controllers/cln/channels.ts @@ -23,7 +23,9 @@ export const listPeerChannels = (req, res, next) => { channel.balancedness = (channel.total_msat === 0) ? 1 : (1 - Math.abs((channel.to_us_msat - channel.to_them_msat) / channel.total_msat)).toFixed(3); // listpeerchannels reports connection state as peer_connected. Mirror it onto the // legacy 'connected' field so backward-compat consumers stay in sync (issue #1606). - channel.connected = channel.peer_connected; + // Coerce to a real boolean so strict-equality readers (e.g. onchain.ts's + // connected === false) behave correctly even when peer_connected is absent. + channel.connected = !!channel.peer_connected; return getAlias(req.session.selectedNode, channel, 'peer_id'); }); common.runWithConcurrencyLimit(getPeerAliasesTasks, 20, () => {