Skip to content
Open
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
10 changes: 8 additions & 2 deletions src/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,14 @@ impl LightningBalance {
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();
// When confirmed_balance_candidate_index is 0, no specific alternative
// funding has been confirmed yet, so use the last candidate (most current
// splice/RBF attempt), matching LDK's claimable_amount_satoshis behavior.
let balance = if confirmed_balance_candidate_index != 0 {
&balance_candidates[confirmed_balance_candidate_index]
} else {
balance_candidates.last().unwrap()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind adding the unwrap-safety comment back?

};

Self::ClaimableOnChannelClose {
channel_id,
Expand Down
Loading