Skip to content

Commit bbc3c65

Browse files
committed
fix Clarification comment regarding change-inclusion in input check
Also minor test fix
1 parent 562c438 commit bbc3c65

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
@@ -4097,7 +4097,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
40974097

40984098
/// Check that balances meet the channel reserve requirements or violates them (below reserve).
40994099
/// The channel value is an input as opposed to using from self, so that this can be used in case of splicing
4100-
/// to checks with new channel value (before being comitted to it).
4100+
/// to check with new channel value (before being comitted to it).
41014101
#[cfg(splicing)]
41024102
pub fn check_balance_meets_v2_reserve_requirements(&self, self_balance: u64, counterparty_balance: u64, channel_value: u64) -> Result<(), ChannelError> {
41034103
if self_balance > 0 {
@@ -4714,7 +4714,11 @@ pub(super) fn check_v2_funding_inputs_sufficient(
47144714
// If the inputs are less, but enough to cover intended contribution amount, with
47154715
// (lower) fees with no change, we are also fine (change will not be generated).
47164716
// So it's enough to check considering the lower, no-change fees.
4717+
//
47174718
// Note: dust limit is not relevant in this check.
4719+
//
4720+
// TODO(splicing): refine check including the fact wether a change will be added or not.
4721+
// Can be done once dual funding preparation is included.
47184722

47194723
let minimal_input_amount_needed = contribution_amount.saturating_add(estimated_fee as i64);
47204724
if (total_input_sats as i64) < minimal_input_amount_needed {
@@ -12987,7 +12991,7 @@ mod tests {
1298712991
);
1298812992
assert_eq!(
1298912993
format!("{:?}", res.err().unwrap()),
12990-
"Warn : Total input amount 100000 is lower than needed for contribution 220000, considering fees of 1410. Need more inputs.",
12994+
"Warn: Total input amount 100000 is lower than needed for contribution 220000, considering fees of 1410. Need more inputs.",
1299112995
);
1299212996
}
1299312997

@@ -13023,7 +13027,7 @@ mod tests {
1302313027
);
1302413028
assert_eq!(
1302513029
format!("{:?}", res.err().unwrap()),
13026-
"Warn : Total input amount 300000 is lower than needed for contribution 298032, considering fees of 2143. Need more inputs.",
13030+
"Warn: Total input amount 300000 is lower than needed for contribution 298032, considering fees of 2143. Need more inputs.",
1302713031
);
1302813032
}
1302913033

0 commit comments

Comments
 (0)