Skip to content
Merged
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
14 changes: 10 additions & 4 deletions src/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,16 @@ 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)
.expect("LDK should provide a valid confirmed balance candidate index");
// 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()
.expect("balance_candidates always contains at least the current funding")
};

Self::ClaimableOnChannelClose {
channel_id,
Expand Down