Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 480
Expose HTLCStats in ChannelDetails#2349
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
Closed
wvanlint
wants to merge
1
commit into
lightningdevkit:main
from
wvanlint:htlc_stats_in_channel_details
Uh oh!
There was an error while loading. Please reload this page.
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1272,6 +1272,39 @@ pub struct ChannelCounterparty { | ||
| pub outbound_htlc_maximum_msat: Option<u64>, | ||
| } | ||
| /// An enum gathering stats on pending HTLCs, either inbound or outbound side. | ||
| #[derive(Debug, Clone, Copy, PartialEq)] | ||
| pub struct HTLCStats { | ||
| /// The number of pending HTLCs. | ||
| pub pending_htlcs: u32, | ||
| /// The total value of pending HTLCs. | ||
| pub pending_htlcs_value_msat: u64, | ||
| /// The total dust exposure for the counterparty. | ||
| pub on_counterparty_tx_dust_exposure_msat: u64, | ||
| /// The total dust exposure for the local node. | ||
| pub on_holder_tx_dust_exposure_msat: u64, | ||
| /// The total value of pending, outgoing HTLCs being held. | ||
| /// | ||
| /// These HTLCs are being held temporarily after sending commitment_signed to discern them | ||
| /// from HTLCs implicitly included in the counterparty's revoke_and_ack. | ||
| pub holding_cell_msat: u64, | ||
| /// The number of pending, outgoing HTLCs being added that are being held, | ||
| /// dust HTLCS not included. | ||
| /// | ||
| /// These HTLCs are being held temporarily after sending commitment_signed to discern them | ||
| /// from HTLCs implicitly included in the counterparty's revoke_and_ack. | ||
| pub on_holder_tx_holding_cell_htlcs_count: u32, | ||
| } | ||
| impl_writeable_tlv_based!(HTLCStats, { | ||
| (0, pending_htlcs, required), | ||
| (2, pending_htlcs_value_msat, required), | ||
| (4, on_counterparty_tx_dust_exposure_msat, required), | ||
| (6, on_holder_tx_dust_exposure_msat, required), | ||
| (8, holding_cell_msat, required), | ||
| (10, on_holder_tx_holding_cell_htlcs_count, required), | ||
| }); | ||
| /// Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`] | ||
| #[derive(Clone, Debug, PartialEq)] | ||
| pub struct ChannelDetails { | ||
| @@ -1443,6 +1476,14 @@ pub struct ChannelDetails { | ||
| /// | ||
| /// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. | ||
| pub config: Option<ChannelConfig>, | ||
| /// Statistics on pending incoming HTLCs. | ||
| /// | ||
| /// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.116. | ||
| pub incoming_htlc_stats: Option<HTLCStats>, | ||
| /// Statistics on pending outgoing HTLCs. | ||
| /// | ||
| /// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.116. | ||
| pub outgoing_htlc_stats: Option<HTLCStats>, | ||
| } | ||
| impl ChannelDetails { | ||
| @@ -1514,6 +1555,8 @@ impl ChannelDetails { | ||
| inbound_htlc_minimum_msat: Some(channel.get_holder_htlc_minimum_msat()), | ||
| inbound_htlc_maximum_msat: channel.get_holder_htlc_maximum_msat(), | ||
| config: Some(channel.config()), | ||
| incoming_htlc_stats: Some(channel.get_inbound_pending_htlc_stats(None)), | ||
| outgoing_htlc_stats: Some(channel.get_outbound_pending_htlc_stats(None)), | ||
| } | ||
| } | ||
| } | ||
| @@ -7156,6 +7199,8 @@ impl Writeable for ChannelDetails { | ||
| (35, self.inbound_htlc_maximum_msat, option), | ||
| (37, user_channel_id_high_opt, option), | ||
| (39, self.feerate_sat_per_1000_weight, option), | ||
| (41, self.incoming_htlc_stats, option), | ||
| (43, self.outgoing_htlc_stats, option), | ||
tnull marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| }); | ||
| Ok(()) | ||
| } | ||
| @@ -7193,6 +7238,8 @@ impl Readable for ChannelDetails { | ||
| (35, inbound_htlc_maximum_msat, option), | ||
| (37, user_channel_id_high_opt, option), | ||
| (39, feerate_sat_per_1000_weight, option), | ||
| (40, incoming_htlc_stats, option), | ||
| (41, outgoing_htlc_stats, option), | ||
| }); | ||
| // `user_channel_id` used to be a single u64 value. In order to remain backwards compatible with | ||
| @@ -7228,6 +7275,8 @@ impl Readable for ChannelDetails { | ||
| inbound_htlc_minimum_msat, | ||
| inbound_htlc_maximum_msat, | ||
| feerate_sat_per_1000_weight, | ||
| incoming_htlc_stats, | ||
| outgoing_htlc_stats, | ||
| }) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the
channelmodule is not public,HTLCStatsis currently not exposed. We need to expose the object itself if it is now exposed throughChannelDetails.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved
HTLCStatsto thechannelmanagermodule for that purpose.