mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2026-08-13 12:33:07 +02:00
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) <noreply@anthropic.com>
This commit is contained in:
parent
5659ba250b
commit
512aea96e5
1 changed files with 3 additions and 1 deletions
|
|
@ -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, () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue