File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
lightning/src/events/bump_transaction Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -507,6 +507,9 @@ where
507507 {
508508 break ;
509509 }
510+ // If adding this UTXO to `selected_utxos` would push us over the
511+ // `max_coin_selection_weight`, remove UTXOs from the front to make room
512+ // for this new UTXO.
510513 while selected_utxos_weight + BASE_INPUT_WEIGHT + utxo. satisfaction_weight
511514 > max_coin_selection_weight
512515 && !selected_utxos. is_empty ( )
@@ -534,6 +537,9 @@ where
534537 ) ;
535538 return Err ( ( ) ) ;
536539 }
540+ // Once we've selected enough UTXOs to cover `target_amount_sat + total_fees`,
541+ // we may be able to remove some small-value ones while still covering
542+ // `target_amount_sat + total_fees`.
537543 while !selected_utxos. is_empty ( )
538544 && selected_amount - selected_utxos. front ( ) . unwrap ( ) . 0 . output . value
539545 >= target_amount_sat + total_fees - selected_utxos. front ( ) . unwrap ( ) . 1
You can’t perform that action at this time.
0 commit comments