File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -10708,11 +10708,23 @@ where
1070810708 if post_balance >= post_channel_reserve_sats * 1000 {
1070910709 return Ok(());
1071010710 }
10711- let pre_channel_reserve_sats =
10712- get_v2_channel_reserve_satoshis(pre_channel_value, dust_limit);
10713- if pre_balance >= pre_channel_reserve_sats * 1000 {
10714- // We're not allowed to dip below the reserve once we've been above.
10715- return Err(post_channel_reserve_sats);
10711+ // We're not allowed to dip below the reserve once we've been above,
10712+ // check differently for originally v1 and v2 channels
10713+ if self.is_v2_established() {
10714+ let pre_channel_reserve_sats =
10715+ get_v2_channel_reserve_satoshis(pre_channel_value, dust_limit);
10716+ if pre_balance >= pre_channel_reserve_sats * 1000 {
10717+ return Err(post_channel_reserve_sats);
10718+ }
10719+ } else {
10720+ if pre_balance >= self.funding.holder_selected_channel_reserve_satoshis * 1000 {
10721+ return Err(post_channel_reserve_sats);
10722+ }
10723+ if let Some(cp_reserve) = self.funding.counterparty_selected_channel_reserve_satoshis {
10724+ if pre_balance >= cp_reserve * 1000 {
10725+ return Err(post_channel_reserve_sats);
10726+ }
10727+ }
1071610728 }
1071710729 // Make sure we either remain with the same balance or move towards the reserve.
1071810730 if post_balance >= pre_balance {
You can’t perform that action at this time.
0 commit comments