Skip to content

fix: short channel id in connection details#1002

Merged
ovitrif merged 3 commits into
masterfrom
fix/connection-detail-ids
Jun 9, 2026
Merged

fix: short channel id in connection details#1002
ovitrif merged 3 commits into
masterfrom
fix/connection-detail-ids

Conversation

@jvsena42

@jvsena42 jvsena42 commented Jun 9, 2026

Copy link
Copy Markdown
Member

Fixes #702

This PR corrects the Channel ID shown on the Lightning Connection Details screen so it displays the short channel ID in Core Lightning block x tx x output form (for example 777477x916x0) instead of the 64-character internal channel ID, which is far longer than the short channel IDs people expect.

Description

The short channel ID comes from the node for open channels, as a numeric BOLT scid that is decoded into block x tx x output form. Closed channels are not stored with one, so it falls back to the short channel ID from a confidently linked Blocktank or CJIT order (matched by funding transaction or order id, not a loose counterparty guess). Blocktank already delivers that value in block x tx x output form, so it is kept as-is; a numeric value is still decoded as a safeguard. The Channel ID row is hidden when no value is available, rather than showing the internal identifier.

This is a port of the iOS fix in synonymdev/bitkit-ios#587. The channel point was already correct on Android — it already reads the funding outpoint (funding_txid:vout) from the channel's own data and hides the row when unavailable — so this change is limited to the Channel ID.

A reusable ULong.formattedAsShortChannelId() extension decodes the numeric BOLT scid (block height in the high 24 bits, transaction index in the next 24, funding output index in the low 16).

Preview

https://mempool.bitkit.stag0.blocktank.to/tx/bf7168f068c77d9588f35c2463ce0168bad719678969670592efc755dcdf9ee3#vout=0

cjit-channel.webm

https://mempool.bitkit.stag0.blocktank.to/tx/bf7168f068c77d9588f35c2463ce0168bad719678969670592efc755dcdf9ee3#vout=0

normal-order.webm
closed-order.webm

QA Notes

Manual Tests

  • 1. Settings → Advanced → Lightning Connections → tap open connection → Channel Detail: Channel ID shows the short channel ID (block x tx x output) matching Blocktank, not the long 64-character id.
  • 2. Channel Detail → tap Channel ID row: copies the short channel ID.
  • 3a. regression: Channel Detail → Channel point row: shows the funding outpoint (funding_txid:vout) matching the Order Details Transaction.
    • 3b. regression: Channel Detail → tap Channel point row: copies the value.
  • 4. Lightning Connections → Show Closed & Failed → tap closed connection → Channel Detail: Channel point shows the funding outpoint; Channel ID row appears only when a Blocktank/CJIT order is confidently linked, otherwise it is hidden.

Automated Checks

  • Unit tests added: cover the scid formatter and display resolver in app/src/test/java/to/bitkit/ext/ShortChannelIdTest.kt, including the issue's numeric 854845001888432128777477x916x0 decode, the closed-channel fallback keeping Blocktank's already-formatted 792906x599x1, and malformed/empty values returning nothing.
  • Local: just test file ShortChannelIdTest, just compile, and just lint pass.
  • CI: standard compile, unit test, and detekt checks run by the PR bot.

@jvsena42 jvsena42 self-assigned this Jun 9, 2026
@jvsena42 jvsena42 added this to the 2.4.0 milestone Jun 9, 2026
@jvsena42
jvsena42 marked this pull request as ready for review June 9, 2026 17:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37ee77d4b8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread app/src/main/java/to/bitkit/ext/ShortChannelId.kt Outdated

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't BT LSP using LND? Why is there focus on CLN then? 🤔
NVM got my answer.

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tAck

@ovitrif
ovitrif merged commit e7547cd into master Jun 9, 2026
17 checks passed
@ovitrif
ovitrif deleted the fix/connection-detail-ids branch June 9, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] IDs in Connection Details wrong

2 participants