-
Notifications
You must be signed in to change notification settings - Fork 113
Adapt channel balance reporting to use confirmed candidate #634
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,7 +73,8 @@ pub struct BalanceDetails { | |
| pub enum LightningBalance { | ||
| /// The channel is not yet closed (or the commitment or closing transaction has not yet | ||
| /// appeared in a block). The given balance is claimable (less on-chain fees) if the channel is | ||
| /// force-closed now. | ||
| /// force-closed now. Values do not take into account any pending splices and are only based | ||
| /// on the confirmed state of the channel. | ||
| ClaimableOnChannelClose { | ||
| /// The identifier of the channel this balance belongs to. | ||
| channel_id: ChannelId, | ||
|
|
@@ -224,21 +225,26 @@ impl LightningBalance { | |
| ) -> Self { | ||
| match balance { | ||
| LdkBalance::ClaimableOnChannelClose { | ||
| amount_satoshis, | ||
| transaction_fee_satoshis, | ||
| outbound_payment_htlc_rounded_msat, | ||
| outbound_forwarded_htlc_rounded_msat, | ||
| inbound_claiming_htlc_rounded_msat, | ||
| inbound_htlc_rounded_msat, | ||
| } => Self::ClaimableOnChannelClose { | ||
| channel_id, | ||
| counterparty_node_id, | ||
| amount_satoshis, | ||
| transaction_fee_satoshis, | ||
| balance_candidates, | ||
| confirmed_balance_candidate_index, | ||
| outbound_payment_htlc_rounded_msat, | ||
| outbound_forwarded_htlc_rounded_msat, | ||
| inbound_claiming_htlc_rounded_msat, | ||
| inbound_htlc_rounded_msat, | ||
| } => { | ||
| // unwrap safety: confirmed_balance_candidate_index is guaranteed to index into balance_candidates | ||
| let balance = balance_candidates.get(confirmed_balance_candidate_index).unwrap(); | ||
joostjager marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Self::ClaimableOnChannelClose { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mind updating the docs on our
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added that values are based on the confirmed channel state, ignoring pending splices. I don't think it is what you suggest, that we are just exposing in a splicing scenario?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted above that this is not the case. Confirmed but not locked splices are taken into account. Also, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah when the index is 0, either we don't have a pending splice, or we do but none of the splice transactions has confirmed. In the latter case, we still want to report some indication of the unconfirmed splice balance. |
||
| channel_id, | ||
| counterparty_node_id, | ||
| amount_satoshis: balance.amount_satoshis, | ||
| transaction_fee_satoshis: balance.transaction_fee_satoshis, | ||
| outbound_payment_htlc_rounded_msat, | ||
| outbound_forwarded_htlc_rounded_msat, | ||
| inbound_claiming_htlc_rounded_msat, | ||
| inbound_htlc_rounded_msat, | ||
| } | ||
| }, | ||
| LdkBalance::ClaimableAwaitingConfirmations { | ||
| amount_satoshis, | ||
|
|
||
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.
I don't believe this is the case. It will take into account a pending splice if it is confirmed but not locked (i.e., doesn't have sufficient number of confirmations).
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.
BTW, let us know if there is a way to update the docs to make this clear.