Skip to content

Fix possible dust HTLC sweep tx when feerate remains unchanged during a bump #3832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions lightning/src/chain/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1365,11 +1365,11 @@ impl PackageTemplate {
predicted_weight, input_amounts, dust_limit_sats, self.feerate_previous,
feerate_strategy, conf_target, fee_estimator, logger,
) {
return Some((input_amounts.saturating_sub(new_fee), feerate));
return Some((cmp::max(input_amounts.saturating_sub(new_fee), dust_limit_sats), feerate));
}
} else {
if let Some((new_fee, feerate)) = compute_fee_from_spent_amounts(input_amounts, predicted_weight, conf_target, fee_estimator, logger) {
return Some((cmp::max(input_amounts as i64 - new_fee as i64, dust_limit_sats as i64) as u64, feerate));
return Some((cmp::max(input_amounts.saturating_sub(new_fee), dust_limit_sats), feerate));
}
}
None
Expand Down