Skip to content

Commit 3e2ac44

Browse files
committed
Debit funder's output to cover anchors
1 parent 010bcd1 commit 3e2ac44

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,10 +1327,11 @@ impl<Signer: Sign> Channel<Signer> {
13271327
}
13281328

13291329
let total_fee_sat = Channel::<Signer>::commit_tx_fee_sat(feerate_per_kw, included_non_dust_htlcs.len(), self.channel_transaction_parameters.opt_anchors.is_some());
1330+
let anchors_val = if self.channel_transaction_parameters.opt_anchors.is_some() { ANCHOR_OUTPUT_VALUE_SATOSHI * 2 } else { 0 } as i64;
13301331
let (value_to_self, value_to_remote) = if self.is_outbound() {
1331-
(value_to_self_msat / 1000 - total_fee_sat as i64, value_to_remote_msat / 1000)
1332+
(value_to_self_msat / 1000 - anchors_val - total_fee_sat as i64, value_to_remote_msat / 1000)
13321333
} else {
1333-
(value_to_self_msat / 1000, value_to_remote_msat / 1000 - total_fee_sat as i64)
1334+
(value_to_self_msat / 1000, value_to_remote_msat / 1000 - anchors_val - total_fee_sat as i64)
13341335
};
13351336

13361337
let mut value_to_a = if local { value_to_self } else { value_to_remote };

0 commit comments

Comments
 (0)