File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -231,10 +231,16 @@ impl LightningBalance {
231231 inbound_claiming_htlc_rounded_msat,
232232 inbound_htlc_rounded_msat,
233233 } => {
234- // unwrap safety: confirmed_balance_candidate_index is guaranteed to index into balance_candidates
235- let balance = balance_candidates
236- . get ( confirmed_balance_candidate_index)
237- . expect ( "LDK should provide a valid confirmed balance candidate index" ) ;
234+ // When confirmed_balance_candidate_index is 0, no specific alternative
235+ // funding has been confirmed yet, so use the last candidate (most current
236+ // splice/RBF attempt), matching LDK's claimable_amount_satoshis behavior.
237+ let balance = if confirmed_balance_candidate_index != 0 {
238+ & balance_candidates[ confirmed_balance_candidate_index]
239+ } else {
240+ balance_candidates
241+ . last ( )
242+ . expect ( "balance_candidates always contains at least the current funding" )
243+ } ;
238244
239245 Self :: ClaimableOnChannelClose {
240246 channel_id,
You can’t perform that action at this time.
0 commit comments