ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.81k stars 889 forks source link

Private 0-conf channel in listpeerchannels has no short_channel_id #7641

Closed Impa10r closed 2 weeks ago

Impa10r commented 2 weeks ago

Issue and Steps to Reproduce

Why does this peer have no short_channel_id!?

$ lcli listpeerchannels
...
      {
         "peer_id": "020ed4ea09c56c3e398190ae5ac60504fe4e56d6989d49e2f7845f14608c546854",
         "peer_connected": true,
         "reestablished": true,
         "channel_type": {
            "bits": [
               12,
               22,
               46,
               50
            ],
            "names": [
               "static_remotekey/even",
               "anchors/even",
               "scid_alias/even",
               "zeroconf/even"
            ]
         },
         "ignore_fee_limits": true,
         "updates": {
            "local": {
               "htlc_minimum_msat": 1,
               "htlc_maximum_msat": 297000000,
               "cltv_expiry_delta": 6,
               "fee_base_msat": 1,
               "fee_proportional_millionths": 10
            },
            "remote": {
               "htlc_minimum_msat": 1000,
               "htlc_maximum_msat": 300000000,
               "cltv_expiry_delta": 80,
               "fee_base_msat": 1000,
               "fee_proportional_millionths": 1
            }
         },
         "last_stable_connection": 1725523506,
         "state": "CHANNELD_NORMAL",
         "scratch_txid": "bd5ff597f2f0a7abf0de2e011563e6bbd7c88cd19f108a312fb3c4a2b246d682",
         "last_tx_fee_msat": 3440000,
         "lost_state": false,
         "feerate": {
            "perkw": 2500,
            "perkb": 10000
         },
         "owner": "channeld",
         "direction": 0,
         "channel_id": "96a4791fddc06c31229c567d6173b39cbcc2f627e77ba9e3e60657e5089d1b23",
         "funding_txid": "231b9d08e55706e6e3a97be727f6c2bc9cb373617d569c22316cc0dd1f79a496",
         "funding_outnum": 0,
         "close_to_addr": "tb1pz340qxrn07fe89e857ev0w8h9lcgy0sg4xacd9sxer7tyz3u3vasey0jve",
         "close_to": "5120146af018737f93939727a7b2c7b8f72ff0823e08a9bb869606c8fcb20a3c8b3b",
         "private": true,
         "opener": "remote",
         "alias": {
            "local": "10175907x3805336x23119",
            "remote": "16000000x0x2"
         },
         "features": [
            "option_static_remotekey",
            "option_anchors_zero_fee_htlc_tx",
            "option_anchors",
            "option_zeroconf",
            "option_scid_alias"
         ],
         "funding": {
            "local_funds_msat": 0,
            "remote_funds_msat": 300000000,
            "pushed_msat": 0
         },
         "to_us_msat": 300000,
         "min_to_us_msat": 0,
         "max_to_us_msat": 300000,
         "total_msat": 300000000,
         "fee_base_msat": 1,
         "fee_proportional_millionths": 10,
         "dust_limit_msat": 546000,
         "max_total_htlc_in_msat": 18446744073709551615,
         "their_reserve_msat": 3000000,
         "our_reserve_msat": 3000000,
         "spendable_msat": 0,
         "receivable_msat": 288866000,
         "minimum_htlc_in_msat": 0,
         "minimum_htlc_out_msat": 1,
         "maximum_htlc_out_msat": 297000000,
         "their_to_self_delay": 6,
         "our_to_self_delay": 144,
         "max_accepted_htlcs": 483,
         "state_changes": [
            {
               "timestamp": "2024-09-02T19:27:12.081Z",
               "old_state": "CHANNELD_AWAITING_LOCKIN",
               "new_state": "CHANNELD_NORMAL",
               "cause": "remote",
               "message": "Lockin complete"
            }
         ],
         "status": [
            "CHANNELD_NORMAL:Reconnected, and reestablished.",
            "CHANNELD_NORMAL:Channel ready for use."
         ],
         "in_payments_offered": 6,
         "in_offered_msat": 600000,
         "in_payments_fulfilled": 3,
         "in_fulfilled_msat": 300000,
         "out_payments_offered": 0,
         "out_offered_msat": 0,
         "out_payments_fulfilled": 0,
         "out_fulfilled_msat": 0,
         "htlcs": []
      }
   ]
}

As a result, invoices paid via this channel have alias: local stored as short_channle_id for their HTLCs:

$ lcli listinvoices
...
 {
         "label": "test4",
...
         "payment_hash": "8c451777f7b0a93b1a6f1d58280a6d01dff8bd36c6d561c270250ac69001a73f",
         "amount_msat": 100000,
         "status": "paid",
...
}

$ lcli sql -k query="SELECT short_channel_id, payment_hash, state FROM htlcs WHERE payment_hash=x'8c451777f7b0a93b1a6f1d58280a6d01dff8bd36c6d561c270250ac69001a73f';"
{
   "rows": [
      [
         "10175907x3805336x23119",
         "8c451777f7b0a93b1a6f1d58280a6d01dff8bd36c6d561c270250ac69001a73f",
         "SENT_REMOVE_ACK_REVOCATION"
      ]
   ]
}

$ lcli listpeerchannels | grep short_channel_id
         "short_channel_id": "2537716x36x0",
         "short_channel_id": "2902458x897x0",
         "short_channel_id": "2821409x111x0",

$ lcli listpeerchannels | grep 10175907x3805336x23119
            "local": "10175907x3805336x23119",

getinfo output

v24.08

Impa10r commented 2 weeks ago

Ok, I figured this out. It is a private 0-conf channel... I forgot I had it ))