From: Matt Corallo Date: Wed, 5 May 2021 18:43:38 +0000 (+0000) Subject: Print more clear information about channel state in listchannels X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=4ee09b08468194b2351f65c4d47dfd97d80854f8;p=ldk-sample Print more clear information about channel state in listchannels 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. --- diff --git a/src/cli.rs b/src/cli.rs index f762fe5..9a0227c 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -424,19 +424,22 @@ fn list_channels(channel_manager: Arc) { 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()) ); - 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); + 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}},"); }