Print more clear information about channel state in listchannels
authorMatt Corallo <git@bluematt.me>
Wed, 5 May 2021 18:43:38 +0000 (18:43 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 10 May 2021 19:18:40 +0000 (19:18 +0000)
User feedback found `channel_can_send_payments` confusing on its
own, and now that we have an upstream `is_confirmed` field, print
that.

Further, it is useful to have an explicit txid field, even if if is
basically duplicative with channel_id.

src/cli.rs

index f762fe5e5d8f1bc322cd69687b953c7ef3291703..9a0227ca8038319ed699726b004d06c70c906345 100644 (file)
@@ -424,19 +424,22 @@ fn list_channels(channel_manager: Arc<ChannelManager>) {
                println!("");
                println!("\t{{");
                println!("\t\tchannel_id: {},", hex_utils::hex_str(&chan_info.channel_id[..]));
                println!("");
                println!("\t{{");
                println!("\t\tchannel_id: {},", hex_utils::hex_str(&chan_info.channel_id[..]));
+               if let Some(funding_txo) = chan_info.funding_txo {
+                       println!("\t\tfunding_txid: {},", funding_txo.txid);
+               }
                println!(
                        "\t\tpeer_pubkey: {},",
                        hex_utils::hex_str(&chan_info.remote_network_id.serialize())
                );
                println!(
                        "\t\tpeer_pubkey: {},",
                        hex_utils::hex_str(&chan_info.remote_network_id.serialize())
                );
-               let mut pending_channel = false;
-               match chan_info.short_channel_id {
-                       Some(id) => println!("\t\tshort_channel_id: {},", id),
-                       None => {
-                               pending_channel = true;
-                       }
+               if let Some(id) = chan_info.short_channel_id {
+                       println!("\t\tshort_channel_id: {},", id);
                }
                }
-               println!("\t\tpending_open: {},", pending_channel);
+               println!("\t\tis_confirmed_onchain: {},", chan_info.is_funding_locked);
                println!("\t\tchannel_value_satoshis: {},", chan_info.channel_value_satoshis);
                println!("\t\tchannel_value_satoshis: {},", chan_info.channel_value_satoshis);
+               if chan_info.is_usable {
+                       println!("\t\tavailable_balance_for_send_msat: {},", chan_info.outbound_capacity_msat);
+                       println!("\t\tavailable_balance_for_recv_msat: {},", chan_info.inbound_capacity_msat);
+               }
                println!("\t\tchannel_can_send_payments: {},", chan_info.is_usable);
                println!("\t}},");
        }
                println!("\t\tchannel_can_send_payments: {},", chan_info.is_usable);
                println!("\t}},");
        }