fix(lightning): closed channel short channel ID#591
Conversation
Greptile SummaryThis PR fixes the Channel ID row being hidden on the Connection Detail screen for closed Blocktank channels by teaching the scid resolver to accept a CLN-form
Confidence Score: 4/5Safe to merge; the fix is narrow, well-tested, and the confidence-gating that guards borrowed scid values is preserved. The resolver logic and split handling are correct, tests cover the full range of expected inputs, and the view-model refactor is a straightforward delegation. The one minor concern is that No files require special attention;
|
| Filename | Overview |
|---|---|
| Bitkit/Extensions/ShortChannelId.swift | Adds isClnShortChannelId helper and resolveDisplayShortChannelId function to accept CLN-form scids from Blocktank orders. Logic and split handling look correct; isNumber includes non-ASCII Unicode numerals (minor). |
| Bitkit/ViewModels/ChannelDetailsViewModel.swift | Refactors displayShortChannelId to delegate to the new resolveDisplayShortChannelId; confidence-gating of the linked order's scid is preserved correctly. |
| BitkitTests/ShortChannelIdTests.swift | Good unit coverage: CLN-form passthrough, numeric decode, nil/empty, and several malformed inputs all tested. |
| BitkitTests/ChannelDetailsViewModelTests.swift | New end-to-end test covers the CLN-form order scid path through confidence gating; existing regression tests are intact. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[displayShortChannelId] --> B{channelScid non-nil?}
B -- Yes --> C[format UInt64 as block×tx×output]
B -- No --> D{isLinkedOrderConfident AND order.channel.shortChannelId non-nil?}
D -- No --> E[return nil]
D -- Yes --> F{UInt64 parse succeeds?}
F -- Yes --> G[decode numeric scid → block×tx×output]
F -- No --> H{isClnShortChannelId?}
H -- Yes --> I[return CLN-form string as-is]
H -- No --> E
Reviews (1): Last reviewed commit: "fix: handle blocktank order short chann..." | Re-trigger Greptile
This PR fixes the Channel ID shown on the Lightning Connection Detail screen for closed channels. Connection Details falls back to a confidently linked Blocktank order's short channel ID when a closed channel carries none, but Blocktank delivers that value already in Core Lightning
block x tx x outputform (for example792906x599x1). The previous code only accepted a numeric value, so the conversion failed and the Channel ID row was hidden even when the order supplied one.The display now keeps an already-formatted
block x tx x outputvalue as-is and still decodes a numeric value as a safeguard. The Channel ID row stays hidden only when no value is available.This is a port of the Android fix in synonymdev/bitkit-android#1002 and a follow-up to the iOS Connection Details work in #587.
Linked Issues/Tasks
Screenshot / Video
https://mempool.bitkit.stag0.blocktank.to/tx/043a0c37888ed1f6be2057c1eb5357c2049b92b64a561ca837cc9f6e2a790807#vout=0
oppened-channel.mov
closed-channel.mov
QA Notes
Manual Tests
regression:Lightning Connections → tap an open connection → Connection Detail: Channel ID still shows the short channel ID from the node.Automated Checks
BitkitTests/ShortChannelIdTests.swift— a CLN-form order scid is kept as-is (792906x599x1), a numeric order scid is decoded (854845001888432128→777477x916x0), and empty/malformed values return nothing.BitkitTests/ChannelDetailsViewModelTests.swift.swiftformatclean;xcodebuild ... build-for-testingon the iOS Simulator succeeds.