Skip to content

Enhance lncli listchannels command with the chan_id and short_chan_id (human readable format)#9390

Merged
guggero merged 3 commits into
lightningnetwork:masterfrom
NishantBansal2003:append-channel
Jan 15, 2025
Merged

Enhance lncli listchannels command with the chan_id and short_chan_id (human readable format)#9390
guggero merged 3 commits into
lightningnetwork:masterfrom
NishantBansal2003:append-channel

Conversation

@NishantBansal2003
Copy link
Copy Markdown
Contributor

Change Description

Fixes: #8650
This PR enhances channel ID representation by introducing both integer and string formats for ShortChannelId:

  1. Renamed ChanId to ShortChanIdInt:

    • Renamed to better reflect its role as the integer representation of ShortChannelId.
  2. Added ShortChanId:

    • Introduced a string representation of ShortChannelId in the format block x transaction x output.
  3. Introduced chan_id:

Steps to Test

Steps for reviewers to follow to test the change.

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 28, 2024

Important

Review skipped

Auto reviews are limited to specific labels.

🏷️ Labels to auto review (1)
  • llm-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@NishantBansal2003
Copy link
Copy Markdown
Contributor Author

PTAL @ziggie1984

@ziggie1984
Copy link
Copy Markdown
Collaborator

ziggie1984 commented Dec 29, 2024

Please read the contribution guidelines thoroughly in particular what was immediately catching my eye is the commit structure

@NishantBansal2003
Copy link
Copy Markdown
Contributor Author

Please read the contribution guidelines thoroughly in particular what was immediately catching my eye is the commit structure

Got it! Working on it Now...

@alexbosworth
Copy link
Copy Markdown
Contributor

Maybe people should be warned that a renaming an API attribute would break things

Comment thread lnrpc/lightning.proto Outdated
@NishantBansal2003 NishantBansal2003 changed the title lnrpc: append listchannels command with the chan_id and short_chan_id lnrpc+lnwire: append listchannels command with the chan_id and short_chan_id Jan 1, 2025
@NishantBansal2003
Copy link
Copy Markdown
Contributor Author

Hey @ziggie1984, I have addressed the Git commit structure and made the required changes based on your review. Please take a look.

@ziggie1984
Copy link
Copy Markdown
Collaborator

Thank you for the PR, I think it is enough to have the short_chan_id and the normal channel_id in the rpc msg. Then when for example depicting the channel struct via lncli listchannels we should show both representation for the short channel id, but we should not put the different types into the protofile (int&string) that should then happen at the lncli or application level.

@NishantBansal2003
Copy link
Copy Markdown
Contributor Author

Thank you for the PR, I think it is enough to have the short_chan_id and the normal channel_id in the rpc msg. Then when for example depicting the channel struct via lncli listchannels we should show both representation for the short channel id, but we should not put the different types into the protofile (int&string) that should then happen at the lncli or application level.

Addresses the reviewed changes. Here is how the lncli listchannels output now appears (on the regtest network):

{
    "channels": [
        {
            "active": true,
            "remote_pubkey": "02769271ddfb03149bc9e2e6124bb8d83209284dda3affed0dead73f57b64f45dd",
            "channel_point": "6ab312e3b744e1b80a33a6541697df88766515c31c08e839bf11dc9fcc036a19:0",
            "chan_id": "829031767408640",
            "capacity": "20000",
            "local_balance": "16530",
            "remote_balance": "0",
            "commit_fee": "3140",
            "commit_weight": "772",
            "fee_per_kw": "2500",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [],
            "csv_delay": 144,
            "private": false,
            "initiator": true,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "354",
            "remote_chan_reserve_sat": "354",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "11",
            "uptime": "11",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "354",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "19800000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "354",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "19800000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "alias_scids": [],
            "zero_conf": false,
            "zero_conf_confirmed_scid": "0",
            "peer_alias": "02769271ddfb03149bc9",
            "peer_scid_alias": "0",
            "memo": "",
            "custom_channel_data": "",
            "channel_id": "196a03cc9fdc11bf39e8081cc315657688df971654a6330ab8e144b7e312b36a",
            "short_chan_id": "829031767408640",
            "short_chan_id_str": "754x1x0"
        },
        {
            "active": true,
            "remote_pubkey": "02769271ddfb03149bc9e2e6124bb8d83209284dda3affed0dead73f57b64f45dd",
            "channel_point": "e428fb553769e4e53dbfb9749f8b057272969517ea85c63f46288487bfd62cf0:0",
            "chan_id": "807041534853120",
            "capacity": "100000",
            "local_balance": "0",
            "remote_balance": "96530",
            "commit_fee": "3140",
            "commit_weight": "772",
            "fee_per_kw": "2500",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [],
            "csv_delay": 144,
            "private": false,
            "initiator": false,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "1000",
            "remote_chan_reserve_sat": "1000",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "459",
            "uptime": "421",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "1000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "99000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "1000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "99000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "alias_scids": [],
            "zero_conf": false,
            "zero_conf_confirmed_scid": "0",
            "peer_alias": "02769271ddfb03149bc9",
            "peer_scid_alias": "0",
            "memo": "",
            "custom_channel_data": "",
            "channel_id": "f02cd6bf878428463fc685ea1795967272058b9f74b9bf3de5e4693755fb28e4",
            "short_chan_id": "807041534853120",
            "short_chan_id_str": "734x1x0"
        }
    ]
}

@ziggie1984
Copy link
Copy Markdown
Collaborator

While looking at the protobuf file, a lot of the structs use chan_id for the short channel id, so I am at this point not convinced about deprecating this value but rather just adding a new field for the longer channel id to keep the change small.

Maybe something like funding_outpoint_id

I think it is not really worth dealing with all these name changes in the protofiles if so many structs are affected. Wdyt @guggero ?

@ziggie1984
Copy link
Copy Markdown
Collaborator

I have a better idea:

So initial request was to make the lncli listchannels output more detailed by adding the channel_id and also adding the human-readable representation of the short channel_id to the output of the command.

We can do all this by just changing the lncli program rather than touching the lnd core unit. The human-readable representation of the short_channel_id can be derived from the integer value currently already available. Moreover also the Xored ChannelID can be calculated using the ChannelPoint already available in the grpc msg.

So I favour the approach to not change anything in the RPC code, but just add all the information on the lncli side!

@NishantBansal2003
Copy link
Copy Markdown
Contributor Author

I have a better idea:

So initial request was to make the lncli listchannels output more detailed by adding the channel_id and also adding the human-readable representation of the short channel_id to the output of the command.

We can do all this by just changing the lncli program rather than touching the lnd core unit. The human-readable representation of the short_channel_id can be derived from the integer value currently already available. Moreover also the Xored ChannelID can be calculated using the ChannelPoint already available in the grpc msg.

So I favour the approach to not change anything in the RPC code, but just add all the information on the lncli side!

Done. Here is how the lncli listchannels output now appears:

{
    "channels": [
        {
            "active": false,
            "remote_pubkey": "02769271ddfb03149bc9e2e6124bb8d83209284dda3affed0dead73f57b64f45dd",
            "channel_point": "6ab312e3b744e1b80a33a6541697df88766515c31c08e839bf11dc9fcc036a19:0",
            "funding_outpoint_id": "196a03cc9fdc11bf39e8081cc315657688df971654a6330ab8e144b7e312b36a",
            "chan_id": "829031767408640",
            "chan_id_str": "754x1x0",
            "capacity": "20000",
            "local_balance": "16530",
            "remote_balance": "0",
            "commit_fee": "3140",
            "commit_weight": "772",
            "fee_per_kw": "2500",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [],
            "csv_delay": 144,
            "private": false,
            "initiator": true,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "354",
            "remote_chan_reserve_sat": "354",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "0",
            "uptime": "0",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "354",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "19800000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "354",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "19800000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "alias_scids": [],
            "zero_conf": false,
            "zero_conf_confirmed_scid": "0",
            "peer_alias": "02769271ddfb03149bc9",
            "peer_scid_alias": "0",
            "memo": "",
            "custom_channel_data": ""
        },
        {
            "active": false,
            "remote_pubkey": "02769271ddfb03149bc9e2e6124bb8d83209284dda3affed0dead73f57b64f45dd",
            "channel_point": "e428fb553769e4e53dbfb9749f8b057272969517ea85c63f46288487bfd62cf0:0",
            "funding_outpoint_id": "f02cd6bf878428463fc685ea1795967272058b9f74b9bf3de5e4693755fb28e4",
            "chan_id": "807041534853120",
            "chan_id_str": "734x1x0",
            "capacity": "100000",
            "local_balance": "0",
            "remote_balance": "96530",
            "commit_fee": "3140",
            "commit_weight": "772",
            "fee_per_kw": "2500",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [],
            "csv_delay": 144,
            "private": false,
            "initiator": false,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "1000",
            "remote_chan_reserve_sat": "1000",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "0",
            "uptime": "0",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "1000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "99000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "1000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "99000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "alias_scids": [],
            "zero_conf": false,
            "zero_conf_confirmed_scid": "0",
            "peer_alias": "02769271ddfb03149bc9",
            "peer_scid_alias": "0",
            "memo": "",
            "custom_channel_data": ""
        }
    ]
}

@NishantBansal2003
Copy link
Copy Markdown
Contributor Author

I have a better idea:
So initial request was to make the lncli listchannels output more detailed by adding the channel_id and also adding the human-readable representation of the short channel_id to the output of the command.
We can do all this by just changing the lncli program rather than touching the lnd core unit. The human-readable representation of the short_channel_id can be derived from the integer value currently already available. Moreover also the Xored ChannelID can be calculated using the ChannelPoint already available in the grpc msg.
So I favour the approach to not change anything in the RPC code, but just add all the information on the lncli side!

Done. Here is how the lncli listchannels output now appears:

{
    "channels": [
        {
            "active": false,
            "remote_pubkey": "02769271ddfb03149bc9e2e6124bb8d83209284dda3affed0dead73f57b64f45dd",
            "channel_point": "6ab312e3b744e1b80a33a6541697df88766515c31c08e839bf11dc9fcc036a19:0",
            "funding_outpoint_id": "196a03cc9fdc11bf39e8081cc315657688df971654a6330ab8e144b7e312b36a",
            "chan_id": "829031767408640",
            "chan_id_str": "754x1x0",
            "capacity": "20000",
            "local_balance": "16530",
            "remote_balance": "0",
            "commit_fee": "3140",
            "commit_weight": "772",
            "fee_per_kw": "2500",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [],
            "csv_delay": 144,
            "private": false,
            "initiator": true,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "354",
            "remote_chan_reserve_sat": "354",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "0",
            "uptime": "0",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "354",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "19800000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "354",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "19800000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "alias_scids": [],
            "zero_conf": false,
            "zero_conf_confirmed_scid": "0",
            "peer_alias": "02769271ddfb03149bc9",
            "peer_scid_alias": "0",
            "memo": "",
            "custom_channel_data": ""
        },
        {
            "active": false,
            "remote_pubkey": "02769271ddfb03149bc9e2e6124bb8d83209284dda3affed0dead73f57b64f45dd",
            "channel_point": "e428fb553769e4e53dbfb9749f8b057272969517ea85c63f46288487bfd62cf0:0",
            "funding_outpoint_id": "f02cd6bf878428463fc685ea1795967272058b9f74b9bf3de5e4693755fb28e4",
            "chan_id": "807041534853120",
            "chan_id_str": "734x1x0",
            "capacity": "100000",
            "local_balance": "0",
            "remote_balance": "96530",
            "commit_fee": "3140",
            "commit_weight": "772",
            "fee_per_kw": "2500",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [],
            "csv_delay": 144,
            "private": false,
            "initiator": false,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "1000",
            "remote_chan_reserve_sat": "1000",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "0",
            "uptime": "0",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "1000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "99000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "1000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "99000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "alias_scids": [],
            "zero_conf": false,
            "zero_conf_confirmed_scid": "0",
            "peer_alias": "02769271ddfb03149bc9",
            "peer_scid_alias": "0",
            "memo": "",
            "custom_channel_data": ""
        }
    ]
}

Hi @ziggie1984, just following up in case my previous message was missed.

Copy link
Copy Markdown
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

Yes this is the right approach, left some suggestions. Please also update all the comments as well if you adopt them.

Comment thread cmd/commands/commands.go
This is a protocol gadget required for Dynamic Commitments and Splicing that
will be added later.

* [Added]((https://github.com/lightningnetwork/lnd/pull/9390))
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.

add the release notes under the lncli section

Comment thread cmd/commands/commands.go
Comment thread cmd/commands/commands.go
@NishantBansal2003
Copy link
Copy Markdown
Contributor Author

New output:

{
    "channels": [
        {
            "active": false,
            "remote_pubkey": "0367cb414c9487311a1466b51b911c994d3438713edc373a27110a7162ac1046f5",
            "chan_point": "6ab312e3b744e1b80a33a6541697df88766515c31c08e839bf11dc9fcc036a19:0",
            "chan_id": "196a03cc9fdc11bf39e8081cc315657688df971654a6330ab8e144b7e312b36a",
            "scid": "829031767408640",
            "scid_str": "754x1x0",
            "capacity": "20000",
            "local_balance": "0",
            "remote_balance": "16530",
            "commit_fee": "3140",
            "commit_weight": "772",
            "fee_per_kw": "2500",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [],
            "csv_delay": 144,
            "private": false,
            "initiator": false,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "354",
            "remote_chan_reserve_sat": "354",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "0",
            "uptime": "0",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "354",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "19800000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "354",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "19800000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "alias_scids": [],
            "zero_conf": false,
            "zero_conf_confirmed_scid": "0",
            "peer_alias": "0367cb414c9487311a14",
            "peer_scid_alias": "0",
            "memo": "",
            "custom_channel_data": ""
        },
        {
            "active": false,
            "remote_pubkey": "0367cb414c9487311a1466b51b911c994d3438713edc373a27110a7162ac1046f5",
            "chan_point": "e428fb553769e4e53dbfb9749f8b057272969517ea85c63f46288487bfd62cf0:0",
            "chan_id": "f02cd6bf878428463fc685ea1795967272058b9f74b9bf3de5e4693755fb28e4",
            "scid": "807041534853120",
            "scid_str": "734x1x0",
            "capacity": "100000",
            "local_balance": "96530",
            "remote_balance": "0",
            "commit_fee": "3140",
            "commit_weight": "772",
            "fee_per_kw": "2500",
            "unsettled_balance": "0",
            "total_satoshis_sent": "0",
            "total_satoshis_received": "0",
            "num_updates": "0",
            "pending_htlcs": [],
            "csv_delay": 144,
            "private": false,
            "initiator": true,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "1000",
            "remote_chan_reserve_sat": "1000",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "0",
            "uptime": "0",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "1000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "99000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 144,
                "chan_reserve_sat": "1000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "99000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "alias_scids": [],
            "zero_conf": false,
            "zero_conf_confirmed_scid": "0",
            "peer_alias": "0367cb414c9487311a14",
            "peer_scid_alias": "0",
            "memo": "",
            "custom_channel_data": ""
        }
    ]
}

@saubyk saubyk self-requested a review January 13, 2025 18:00
@ziggie1984 ziggie1984 changed the title lnrpc+lnwire: append listchannels command with the chan_id and short_chan_id Enhance lncli listchannels command with the chan_id and short_chan_id (human readable format) Jan 13, 2025
Copy link
Copy Markdown
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

Great work, had some final comments.

Comment thread cmd/commands/commands.go Outdated
Comment thread cmd/commands/commands.go Outdated
Comment thread cmd/commands/commands.go Outdated
Comment thread docs/release-notes/release-notes-0.19.0.md Outdated
Copy link
Copy Markdown
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

Copy link
Copy Markdown
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Approach ACK.

Comment thread lnwire/short_channel_id.go
Comment thread cmd/commands/commands.go Outdated
// Format a new JSON field for the scid (chan_id),
// including both its numeric representation and its
// string representation (scid_str).
scidStr := lnwire.NewShortChanIDFromInt(scid).String()
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.

Related to my previous comment, we could either call into the alternative method here or do some replacement here directly.

Comment thread cmd/commands/commands.go
now update the channel policy if the edge was not found in the graph
database if the `create_missing_edge` flag is set.

* [Enhance](https://github.com/lightningnetwork/lnd/pull/9390) the `lncli listchannels` output by adding the human readable short channel id and the channel id defined in BOLT02. Moreover change the misnomer of `chan_id` which was describing the short channel id to `scid` to represent what it really is.
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.

Please wrap lines at 80 characters here as well.

Copy link
Copy Markdown
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

Can you squash the commits

Copy link
Copy Markdown
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Nice, thanks for the update. Two more nits then we're good to go!

Comment thread lnwire/short_channel_id.go Outdated
return fmt.Sprintf("%d:%d:%d", c.BlockHeight, c.TxIndex, c.TxPosition)
}

// String generates a human-readable representation of the channel ID
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.

The Godoc domment needs to match the actual method name here.

Comment thread cmd/commands/commands.go Outdated
)[1]

chanOutpoint, err := wire.NewOutPointFromString(
chanPoint)
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.

nit: closing parenthesis should go to a new line.

@ziggie1984
Copy link
Copy Markdown
Collaborator

Maybe I was not clear enough in my previous comment but I meant to squash unnecessary commits that didn't mean squashing the release notes for example.

Add the `AltString` method for `ShortChannelID` to produce a
human-readable format with 'x' as a separator
(block x transaction x output).

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Copy link
Copy Markdown
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

Can squash the unit test commit with the commit which introduces the functions.

LGTM

Comment thread cmd/commands/commands_test.go
Comment thread cmd/commands/commands_test.go Outdated
@ziggie1984 ziggie1984 removed the request for review from saubyk January 15, 2025 10:37
Added scid_str as a string representation of chan_id,
replacing chan_id with scid, and including chan_id(BOLT02)
in lncli listchannels output.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature]: Append the listchannels command with the short_chan_id representation (XXXX:XX:X) besides the 8 byte integer one.

4 participants