lightning-listclosedchannels

lightning-listclosedchannels -- Get data on our closed historical channels

SYNOPSIS

listclosedchannels [id]

DESCRIPTION

Command added in v23.05.

The listclosedchannels RPC command returns data on channels which are otherwise forgotten (more than 100 blocks after they're completely resolved onchain).

  • id (pubkey, optional): If no id is supplied, then channel data on all historical channels are given. Supplying id will filter the results to only match channels to that peer. Note that prior to v23.05, old peers were forgotten.

RETURN VALUE

On success, an object containing closedchannels is returned. It is an array of objects, where each object contains:

  • channel_id (hash): The full channel_id (funding txid Xored with output number).
  • opener (string) (one of "local", "remote"): Who initiated the channel.
  • private (boolean): If True, we will not announce this channel.
  • total_local_commitments (u64): Number of commitment transaction we made.
  • total_remote_commitments (u64): Number of commitment transaction they made.
  • total_htlcs_sent (u64): Number of HTLCs we ever sent.
  • funding_txid (txid): ID of the funding transaction.
  • funding_outnum (u32): The 0-based output number of the funding transaction which opens the channel.
  • leased (boolean): Whether this channel was leased from opener.
  • total_msat (msat): Total amount in the channel.
  • final_to_us_msat (msat): Our balance in final commitment transaction.
  • min_to_us_msat (msat): Least amount owed to us ever. If the peer were to successfully steal from us, this is the amount we would still retain.
  • max_to_us_msat (msat): Most amount owed to us ever. If we were to successfully steal from the peer, this is the amount we could potentially get.
  • close_cause (string) (one of "unknown", "local", "user", "remote", "protocol", "onchain"): What caused the channel to close.
  • peer_id (pubkey, optional): Peer public key (can be missing with pre-v23.05 closes!).
  • short_channel_id (short_channel_id, optional): The short_channel_id.
  • alias (object, optional):
    • local (short_channel_id, optional): An alias assigned by this node to this channel, used for outgoing payments.
    • remote (short_channel_id, optional): An alias assigned by the remote node to this channel, usable in routehints and invoices.
  • closer (string, optional) (one of "local", "remote"): Who initiated the channel close (only present if closing).
  • channel_type (object, optional): Channel_type as negotiated with peer.:
    • bits (array of u32s): Each bit set in this channel_type.:
      • (u32, optional): Bit number.
    • names (array of strings): Feature name for each bit set in this channel_type. Note that anchors_zero_fee_htlc_tx is a deprecated synonym for anchors.:
      • (string, optional) (one of "static_remotekey/even", "anchor_outputs/even", "anchors/even", "anchors_zero_fee_htlc_tx/even", "scid_alias/even", "zeroconf/even"): Name of feature bit.
  • funding_fee_paid_msat (msat, optional): How much we paid to lease the channel (iff leased is true and opener is local).
  • funding_fee_rcvd_msat (msat, optional): How much they paid to lease the channel (iff leased is true and opener is remote).
  • funding_pushed_msat (msat, optional): How much opener pushed immediate (if non-zero).
  • last_commitment_txid (hash, optional): The final commitment tx's txid (or mutual close, if we accepted it). Not present for some very old, small channels pre-0.7.0.
  • last_commitment_fee_msat (msat, optional): The fee on last_commitment_txid.
  • last_stable_connection (u64, optional): Last time we reestablished the open channel and stayed connected for 1 minute. (added v24.02)

ERRORS

On error the returned object will contain code and message properties, with code being one of the following:

  • -32602: If the given parameters are wrong.

AUTHOR

Rusty Russell <[email protected]>.

SEE ALSO

lightning-listpeerchannels(7)

RESOURCES

Main web site: https://github.com/ElementsProject/lightning

EXAMPLES

Example 1:

Request:

lightning-cli listclosedchannels
{
  "id": "example:listclosedchannels#1",
  "method": "listclosedchannels",
  "params": {}
}

Response:

{
  "closedchannels": [
    {
      "peer_id": "nodeid030303030303030303030303030303030303030303030303030303030303",
      "channel_id": "channelid0230000230000230000230000230000230000230000230000230000",
      "short_channel_id": "111x1x1",
      "alias": {
        "local": "121x131x141",
        "remote": "151x161x171"
      },
      "opener": "local",
      "closer": "local",
      "private": false,
      "channel_type": {
        "bits": [
          12,
          22
        ],
        "names": [
          "static_remotekey/even",
          "anchors/even"
        ]
      },
      "total_local_commitments": 16,
      "total_remote_commitments": 16,
      "total_htlcs_sent": 8,
      "funding_txid": "fundingtxid00202020202020202020202020202020202020202020202020202",
      "funding_outnum": 1,
      "leased": false,
      "total_msat": 1000000000,
      "final_to_us_msat": 489809898,
      "min_to_us_msat": 489809898,
      "max_to_us_msat": 1000000000,
      "last_commitment_txid": "txidcloselastcommitment00000100001000010000100001000010000100001",
      "last_commitment_fee_msat": 2895000,
      "close_cause": "user",
      "last_stable_connection": 1738500000
    },
    {
      "peer_id": "nodeid050505050505050505050505050505050505050505050505050505050505",
      "channel_id": "channelid0250000250000250000250000250000250000250000250000250000",
      "short_channel_id": "115x1x1",
      "alias": {
        "local": "122x132x142",
        "remote": "152x162x172"
      },
      "opener": "local",
      "closer": "local",
      "private": true,
      "channel_type": {
        "bits": [
          12,
          22
        ],
        "names": [
          "static_remotekey/even",
          "anchors/even"
        ]
      },
      "total_local_commitments": 2,
      "total_remote_commitments": 2,
      "total_htlcs_sent": 1,
      "funding_txid": "fundingtxid00101010101010101010101010101010101010101010101010101",
      "funding_outnum": 1,
      "leased": false,
      "total_msat": 1000000000,
      "final_to_us_msat": 500000000,
      "min_to_us_msat": 500000000,
      "max_to_us_msat": 1000000000,
      "last_commitment_txid": "txidcloselastcommitment00000200002000020000200002000020000200002",
      "last_commitment_fee_msat": 2896000,
      "close_cause": "user",
      "last_stable_connection": 1738500000
    }
  ]
}

Core Lightning (previously c-lightning) is a lightweight, highly customizable and standard compliant implementation of the Lightning Network protocol.

© 2023 Core Lightning
All rights reserved.

Discussion Forum

The official Core Lightning forum is hosted at discuss.corelightning.org

BuildonL2 Community

The official BuildOnL2 community lives at community.corelightning.org. Join us and build the future of bitcoin on lightning.

Mailing List

For general discussions about CLN implementation, use [email protected]. For the Lightning Network, use [email protected]

Telegram

Community-driven telegram group where most of the node operators hang out. Go to https://t.me/lightningd to join.

Discord

Community-driven discord server where the devs flock together. Go to https://discord.gg/w27fMFESMN to join.

Internet Relay Chat

Don't hesitate to reach out to us on IRC at #lightning-dev @ libera.chat, #c-lightning @ libera.chat.