Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused fields from ChannelsInfo #683

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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