Skip to content

Commit a6d3776

Browse files
committed
Include 0FC channels in anchor channel checks
1 parent 420b25d commit a6d3776

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/event.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,8 @@ where
10881088
}
10891089
}
10901090

1091-
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx();
1091+
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx()
1092+
|| channel_type.requires_anchor_zero_fee_commitments();
10921093
if anchor_channel {
10931094
if let Some(anchor_channels_config) =
10941095
self.config.anchor_channels_config.as_ref()

src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,11 +1082,11 @@ impl Node {
10821082
.peer_by_node_id(&node_id)
10831083
.ok_or(Error::ConnectionFailed)?
10841084
.init_features;
1085+
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx()
1086+
|| init_features.requires_anchor_zero_fee_commitments();
10851087
let required_funds_sats = channel_amount_sats
10861088
+ self.config.anchor_channels_config.as_ref().map_or(0, |c| {
1087-
if init_features.requires_anchors_zero_fee_htlc_tx()
1088-
&& !c.trusted_peers_no_reserve.contains(&node_id)
1089-
{
1089+
if anchor_channel && !c.trusted_peers_no_reserve.contains(&node_id) {
10901090
c.per_channel_reserve_sats
10911091
} else {
10921092
0
@@ -1611,9 +1611,10 @@ pub(crate) fn total_anchor_channels_reserve_sats(
16111611
!anchor_channels_config.trusted_peers_no_reserve.contains(&c.counterparty.node_id)
16121612
&& c.channel_shutdown_state
16131613
.map_or(true, |s| s != ChannelShutdownState::ShutdownComplete)
1614-
&& c.channel_type
1615-
.as_ref()
1616-
.map_or(false, |t| t.requires_anchors_zero_fee_htlc_tx())
1614+
&& c.channel_type.as_ref().map_or(false, |t| {
1615+
t.requires_anchors_zero_fee_htlc_tx()
1616+
|| t.requires_anchor_zero_fee_commitments()
1617+
})
16171618
})
16181619
.count() as u64
16191620
* anchor_channels_config.per_channel_reserve_sats

src/liquidity.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,11 @@ where
667667
total_anchor_channels_reserve_sats(&self.channel_manager, &self.config);
668668
let spendable_amount_sats =
669669
self.wallet.get_spendable_amount_sats(cur_anchor_reserve_sats).unwrap_or(0);
670+
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx()
671+
|| init_features.requires_anchor_zero_fee_commitments();
670672
let required_funds_sats = channel_amount_sats
671673
+ self.config.anchor_channels_config.as_ref().map_or(0, |c| {
672-
if init_features.requires_anchors_zero_fee_htlc_tx()
674+
if anchor_channel
673675
&& !c.trusted_peers_no_reserve.contains(&their_network_key)
674676
{
675677
c.per_channel_reserve_sats

0 commit comments

Comments
 (0)