Skip to content

Commit 5ca9a44

Browse files
committed
fix Use v2 reserve condition for spliced-from-v1 v2 channels as well
1 parent 1af6dd7 commit 5ca9a44

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10591,7 +10591,7 @@ where
1059110591
}
1059210592
// We're not allowed to dip below the reserve once we've been above,
1059310593
// check differently for originally v1 and v2 channels
10594-
if self.is_v2_established() {
10594+
if self.is_v2() {
1059510595
let pre_channel_reserve_sats =
1059610596
get_v2_channel_reserve_satoshis(pre_channel_value_sats, dust_limit_sats);
1059710597
if pre_balance_msat >= (pre_channel_reserve_sats * 1000) {
@@ -11386,6 +11386,17 @@ where
1138611386
// CHANNEL_ANNOUNCEMENT_PROPAGATION_DELAY confirmations.
1138711387
self.context.historical_scids.drain(0..end)
1138811388
}
11389+
11390+
/// Check is channel is currently v2:
11391+
/// - established as v2
11392+
/// - or past a splice (which implicitly makes the channel v2)
11393+
fn is_v2(&self) -> bool {
11394+
if self.funding.channel_transaction_parameters.splice_parent_funding_txid.is_some() {
11395+
true
11396+
} else {
11397+
self.is_v2_established()
11398+
}
11399+
}
1138911400
}
1139011401

1139111402
/// A not-yet-funded outbound (from holder) channel using V1 channel establishment.

0 commit comments

Comments
 (0)