Skip to content

Commit

Permalink
Remove unused fields from ChannelsInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgranhao committed Oct 10, 2023
1 parent ddc123e commit c8a5cfb
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 32 deletions.
12 changes: 0 additions & 12 deletions examples/3l-node/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,6 @@ fn node_info(node: &LightningNode) {
"On-Chain balance: {}",
amount_to_string(node_info.onchain_balance)
);
println!(
" Number of channels: {}",
node_info.channels_info.num_channels
);
println!(
"Number of usable channels: {}",
node_info.channels_info.num_usable_channels
);
println!(
" Local balance: {}",
amount_to_string(node_info.channels_info.local_balance)
Expand All @@ -369,10 +361,6 @@ fn node_info(node: &LightningNode) {
" Outbound capacity: {}",
amount_to_string(node_info.channels_info.outbound_capacity)
);
println!(
" Capacity of all channels: {}",
amount_to_string(node_info.channels_info.total_channel_capacities)
);
}

fn wallet_pubkey_id(node: &LightningNode) {
Expand Down
8 changes: 0 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,9 @@ pub struct NodeInfo {
}

pub struct ChannelsInfo {
// This field will currently always be 0 until Breez SDK exposes more detailed channel information https://github.com/breez/breez-sdk/issues/421
pub num_channels: u16,
// This field will currently always be 0 until Breez SDK exposes more detailed channel information https://github.com/breez/breez-sdk/issues/421
pub num_usable_channels: u16,
pub local_balance: Amount,
pub inbound_capacity: Amount,
pub outbound_capacity: Amount,
pub total_channel_capacities: Amount,
}

#[derive(PartialEq, Eq, Debug, TryFromPrimitive, Clone)]
Expand Down Expand Up @@ -403,12 +398,9 @@ impl LightningNode {
peers: node_state.connected_peers,
onchain_balance: node_state.onchain_balance_msat.to_amount_down(&rate),
channels_info: ChannelsInfo {
num_channels: 0,
num_usable_channels: 0,
local_balance: node_state.channels_balance_msat.to_amount_down(&rate),
inbound_capacity: node_state.inbound_liquidity_msats.to_amount_down(&rate),
outbound_capacity: node_state.max_payable_msat.to_amount_down(&rate),
total_channel_capacities: 0.to_amount_down(&rate),
},
})
}
Expand Down
10 changes: 2 additions & 8 deletions src/lipalightninglib.udl
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,8 @@ dictionary NodeInfo {
};

dictionary ChannelsInfo {
// This field will currently always be 0 until Breez SDK exposes more detailed channel information https://github.com/breez/breez-sdk/issues/421
u16 num_channels; // Number of currently open channels.
// This field will currently always be 0 until Breez SDK exposes more detailed channel information https://github.com/breez/breez-sdk/issues/421
u16 num_usable_channels; // Number of usable channels. E.g. if a peer if offline, channels with that peer won't be usable.
Amount local_balance; // The balance of the local node. Please keep in mind not all of this balance is spendable
// due to Lightning channel reserves
// This field will currently always be 0 until Breez SDK exposes more detailed channel information https://github.com/breez/breez-sdk/issues/421
Amount total_channel_capacities; // Total capacity of all usable channels of the node
// The balance of the local node
Amount local_balance;

// Capacity the node can actually receive.
// It excludes non usable channels, pending HTLCs, channels reserves, etc.
Expand Down
4 changes: 0 additions & 4 deletions tests/node_info_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ fn test_get_node_info() {
PublicKey::from_str(&*node_info.node_pubkey).is_ok(),
"Node public key is not valid"
);
assert!(
node_info.channels_info.num_channels >= node_info.channels_info.num_usable_channels,
"Number of channels must be greater or equal to number of usable channels"
);
assert!(
node_info.channels_info.local_balance.sats < 21_000_000 * 100_000_000,
"Node must not hold more than 21 million BTC on lightning"
Expand Down

0 comments on commit c8a5cfb

Please sign in to comment.