-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lnrpc+lnwire: append listchannels command with the chan_id and short_chan_id #9390
base: master
Are you sure you want to change the base?
lnrpc+lnwire: append listchannels command with the chan_id and short_chan_id #9390
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
6cf95f0
to
755d729
Compare
PTAL @ziggie1984 |
Please read the contribution guidelines thoroughly in particular what was immediately catching my eye is the commit structure |
Got it! Working on it Now... |
Maybe people should be warned that a renaming an API attribute would break things |
lnrpc/lightning.proto
Outdated
@@ -1471,7 +1471,7 @@ message Channel { | |||
height, the next 3 the index within the block, and the last 2 bytes are the | |||
output index for the channel. | |||
*/ | |||
uint64 chan_id = 4 [jstype = JS_STRING]; | |||
uint64 short_chan_id_int = 4 [jstype = JS_STRING]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are not renaming stuff, we are deprecating it instead, so no worries @alexbosworth, this approach is not the right one here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I mark this chan_id as deprecated and introduce fields like short_chan_id_int, short_chan_id, and channel_id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep it but instead return the right chan_id not the short chan id here, but I need to think about backwards-compatibility issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The right chan_id being in string format may also introduce backward compatibility issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I can think of two solutions:
- Mark
chan_id
as deprecated and introduce fields likeshort_chan_id_int
,short_chan_id
, andchannel_id
. - Introduce new names (eg.-
chan_id
foruint64
,chan_id_str
for string, andchannel_id
for BOLT-2 definition) for the additional fields while preserving the same name for the existing field.
wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you cannot reuse this, it is uint64 and for the real channel_id we need string or bytes, so best is to start from a clean state and deprecate the old value.
755d729
to
3d19e19
Compare
Hey @ziggie1984, I have addressed the Git commit structure and made the required changes based on your review. Please take a look. |
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 |
Addresses the reviewed changes. Here is how the {
"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"
}
]
} |
While looking at the protobuf file, a lot of the structs use Maybe something like I think it is not really worth dealing with all these name changes in the protofiles if so many structs are affected. Wdyt @guggero ? |
I have a better idea: So initial request was to make the We can do all this by just changing the So I favour the approach to not change anything in the RPC code, but just add all the information on the lncli side! |
Modified the `String` method of `ShortChannelID` to generate a human-readable representation using 'x' as a separator. (block x transaction x output). Signed-off-by: Nishant Bansal <[email protected]>
…s output. Signed-off-by: Nishant Bansal <[email protected]>
Signed-off-by: Nishant Bansal <[email protected]>
90ed477
to
de85265
Compare
Done. Here is how the {
"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": ""
}
]
} |
Change Description
Fixes: #8650
This PR enhances channel ID representation by introducing both integer and string formats for
ShortChannelId
:Renamed
ChanId
toShortChanIdInt
:ShortChannelId
.Added
ShortChanId
:ShortChannelId
in the formatblock x transaction x output
.Introduced
chan_id
:chan_id
based on the definition in the BOLT-2 Peer Protocol specification, aligning with Lightning Network standards.Steps to Test
Steps for reviewers to follow to test the change.
Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]
in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.