Skip to content

Commit 3bc0b46

Browse files
committed
Include 0FC channels in anchor channel checks
1 parent 11b8b42 commit 3bc0b46

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

src/event.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,8 @@ where
12561256
}
12571257
}
12581258

1259-
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx();
1259+
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx()
1260+
|| channel_type.requires_anchor_zero_fee_commitments();
12601261
if anchor_channel && self.config.anchor_channels_config.is_none() {
12611262
log_error!(
12621263
self.logger,

src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,8 @@ impl Node {
13531353
.peer_by_node_id(peer_node_id)
13541354
.ok_or(Error::ConnectionFailed)?
13551355
.init_features;
1356-
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx();
1356+
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx()
1357+
|| init_features.requires_anchor_zero_fee_commitments();
13571358
Ok(new_channel_anchor_reserve_sats(&self.config, peer_node_id, anchor_channel))
13581359
}
13591360

@@ -2316,9 +2317,10 @@ pub(crate) fn total_anchor_channels_reserve_sats(
23162317
!anchor_channels_config.trusted_peers_no_reserve.contains(&c.counterparty.node_id)
23172318
&& c.channel_shutdown_state
23182319
.map_or(true, |s| s != ChannelShutdownState::ShutdownComplete)
2319-
&& c.channel_type
2320-
.as_ref()
2321-
.map_or(false, |t| t.requires_anchors_zero_fee_htlc_tx())
2320+
&& c.channel_type.as_ref().map_or(false, |t| {
2321+
t.requires_anchors_zero_fee_htlc_tx()
2322+
|| t.requires_anchor_zero_fee_commitments()
2323+
})
23222324
})
23232325
.count() as u64
23242326
* anchor_channels_config.per_channel_reserve_sats

src/liquidity/service/lsps2.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,11 @@ where
452452
total_anchor_channels_reserve_sats(&self.channel_manager, &self.config);
453453
let spendable_amount_sats =
454454
self.wallet.get_spendable_amount_sats(cur_anchor_reserve_sats).unwrap_or(0);
455+
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx()
456+
|| init_features.requires_anchor_zero_fee_commitments();
455457
let required_funds_sats = channel_amount_sats
456458
+ self.config.anchor_channels_config.as_ref().map_or(0, |c| {
457-
if init_features.requires_anchors_zero_fee_htlc_tx()
459+
if anchor_channel
458460
&& !c.trusted_peers_no_reserve.contains(&their_network_key)
459461
{
460462
c.per_channel_reserve_sats

0 commit comments

Comments
 (0)