From 35a6e00b03835f87adbae0b3a4229f6a13b9ca8b Mon Sep 17 00:00:00 2001 From: Ken Sedgwick Date: Tue, 4 Jan 2022 16:05:28 -0800 Subject: [PATCH] Debit funder's output to cover anchors --- lightning/src/ln/channel.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 40650a6bd..24570ea9e 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -1327,10 +1327,11 @@ impl Channel { } let total_fee_sat = Channel::::commit_tx_fee_sat(feerate_per_kw, included_non_dust_htlcs.len(), self.channel_transaction_parameters.opt_anchors.is_some()); + let anchors_val = if self.channel_transaction_parameters.opt_anchors.is_some() { ANCHOR_OUTPUT_VALUE_SATOSHI * 2 } else { 0 } as i64; let (value_to_self, value_to_remote) = if self.is_outbound() { - (value_to_self_msat / 1000 - total_fee_sat as i64, value_to_remote_msat / 1000) + (value_to_self_msat / 1000 - anchors_val - total_fee_sat as i64, value_to_remote_msat / 1000) } else { - (value_to_self_msat / 1000, value_to_remote_msat / 1000 - total_fee_sat as i64) + (value_to_self_msat / 1000, value_to_remote_msat / 1000 - anchors_val - total_fee_sat as i64) }; let mut value_to_a = if local { value_to_self } else { value_to_remote }; -- 2.39.5