Skip to content

Commit 90bdd13

Browse files
committed
fix Clarification comment regarding change-inclusion in input check
Also minor test fix
1 parent 2c97aa3 commit 90bdd13

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lightning/src/ln/channel.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4134,7 +4134,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
41344134

41354135
/// Check that balances meet the channel reserve requirements or violates them (below reserve).
41364136
/// The channel value is an input as opposed to using from self, so that this can be used in case of splicing
4137-
/// to checks with new channel value (before being comitted to it).
4137+
/// to check with new channel value (before being comitted to it).
41384138
#[cfg(splicing)]
41394139
pub fn check_balance_meets_v2_reserve_requirements(&self, self_balance: u64, counterparty_balance: u64, channel_value: u64) -> Result<(), ChannelError> {
41404140
if self_balance > 0 {
@@ -4757,7 +4757,11 @@ pub(super) fn check_v2_funding_inputs_sufficient(
47574757
// If the inputs are less, but enough to cover intended contribution amount, with
47584758
// (lower) fees with no change, we are also fine (change will not be generated).
47594759
// So it's enough to check considering the lower, no-change fees.
4760+
//
47604761
// Note: dust limit is not relevant in this check.
4762+
//
4763+
// TODO(splicing): refine check including the fact wether a change will be added or not.
4764+
// Can be done once dual funding preparation is included.
47614765

47624766
let minimal_input_amount_needed = contribution_amount.saturating_add(estimated_fee as i64);
47634767
if (total_input_sats as i64) < minimal_input_amount_needed {
@@ -13004,7 +13008,7 @@ mod tests {
1300413008
);
1300513009
assert_eq!(
1300613010
format!("{:?}", res.err().unwrap()),
13007-
"Warn : Total input amount 100000 is lower than needed for contribution 220000, considering fees of 1410. Need more inputs.",
13011+
"Warn: Total input amount 100000 is lower than needed for contribution 220000, considering fees of 1410. Need more inputs.",
1300813012
);
1300913013
}
1301013014

@@ -13040,7 +13044,7 @@ mod tests {
1304013044
);
1304113045
assert_eq!(
1304213046
format!("{:?}", res.err().unwrap()),
13043-
"Warn : Total input amount 300000 is lower than needed for contribution 298032, considering fees of 2143. Need more inputs.",
13047+
"Warn: Total input amount 300000 is lower than needed for contribution 298032, considering fees of 2143. Need more inputs.",
1304413048
);
1304513049
}
1304613050

0 commit comments

Comments
 (0)