Skip to content

Commit 8294863

Browse files
committed
Include 0FC channels in anchor channel checks
1 parent 1fd93f5 commit 8294863

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
@@ -1231,7 +1231,8 @@ where
12311231
}
12321232
}
12331233

1234-
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx();
1234+
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx()
1235+
|| channel_type.requires_anchor_zero_fee_commitments();
12351236
if anchor_channel && self.config.anchor_channels_config.is_none() {
12361237
log_error!(
12371238
self.logger,

src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,8 @@ impl Node {
12661266
.peer_by_node_id(peer_node_id)
12671267
.ok_or(Error::ConnectionFailed)?
12681268
.init_features;
1269-
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx();
1269+
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx()
1270+
|| init_features.requires_anchor_zero_fee_commitments();
12701271
Ok(new_channel_anchor_reserve_sats(&self.config, peer_node_id, anchor_channel))
12711272
}
12721273

@@ -2170,9 +2171,10 @@ pub(crate) fn total_anchor_channels_reserve_sats(
21702171
!anchor_channels_config.trusted_peers_no_reserve.contains(&c.counterparty.node_id)
21712172
&& c.channel_shutdown_state
21722173
.map_or(true, |s| s != ChannelShutdownState::ShutdownComplete)
2173-
&& c.channel_type
2174-
.as_ref()
2175-
.map_or(false, |t| t.requires_anchors_zero_fee_htlc_tx())
2174+
&& c.channel_type.as_ref().map_or(false, |t| {
2175+
t.requires_anchors_zero_fee_htlc_tx()
2176+
|| t.requires_anchor_zero_fee_commitments()
2177+
})
21762178
})
21772179
.count() as u64
21782180
* anchor_channels_config.per_channel_reserve_sats

src/liquidity.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,11 @@ where
758758
total_anchor_channels_reserve_sats(&self.channel_manager, &self.config);
759759
let spendable_amount_sats =
760760
self.wallet.get_spendable_amount_sats(cur_anchor_reserve_sats).unwrap_or(0);
761+
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx()
762+
|| init_features.requires_anchor_zero_fee_commitments();
761763
let required_funds_sats = channel_amount_sats
762764
+ self.config.anchor_channels_config.as_ref().map_or(0, |c| {
763-
if init_features.requires_anchors_zero_fee_htlc_tx()
765+
if anchor_channel
764766
&& !c.trusted_peers_no_reserve.contains(&their_network_key)
765767
{
766768
c.per_channel_reserve_sats

0 commit comments

Comments
 (0)