Skip to content

Commit ab132ab

Browse files
committed
Ensure package output is not less than dust limit
When bumping an HTLC sweep transaction, if the feerate remains unchanged, `feerate_bump` doesn't check whether the output amount is below the dust limit. However, this situation can occur if the transaction's inputs are modified. See also: #3831
1 parent 97f0e4b commit ab132ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lightning/src/chain/package.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,11 +1365,11 @@ impl PackageTemplate {
13651365
predicted_weight, input_amounts, dust_limit_sats, self.feerate_previous,
13661366
feerate_strategy, conf_target, fee_estimator, logger,
13671367
) {
1368-
return Some((input_amounts.saturating_sub(new_fee), feerate));
1368+
return Some((cmp::max(input_amounts.saturating_sub(new_fee), dust_limit_sats), feerate));
13691369
}
13701370
} else {
13711371
if let Some((new_fee, feerate)) = compute_fee_from_spent_amounts(input_amounts, predicted_weight, conf_target, fee_estimator, logger) {
1372-
return Some((cmp::max(input_amounts as i64 - new_fee as i64, dust_limit_sats as i64) as u64, feerate));
1372+
return Some((cmp::max(input_amounts.saturating_sub(new_fee), dust_limit_sats), feerate));
13731373
}
13741374
}
13751375
None

0 commit comments

Comments
 (0)