Skip to content

Commit 68c21a9

Browse files
committed
Include 0FC channels in anchor channel checks
1 parent f15f97f commit 68c21a9

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
@@ -1080,7 +1080,8 @@ where
10801080
}
10811081
}
10821082

1083-
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx();
1083+
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx()
1084+
|| channel_type.requires_anchor_zero_fee_commitments();
10841085
if anchor_channel {
10851086
if let Some(anchor_channels_config) =
10861087
self.config.anchor_channels_config.as_ref()

src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,11 +1090,11 @@ impl Node {
10901090
.peer_by_node_id(&node_id)
10911091
.ok_or(Error::ConnectionFailed)?
10921092
.init_features;
1093+
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx()
1094+
|| init_features.requires_anchor_zero_fee_commitments();
10931095
let required_funds_sats = channel_amount_sats
10941096
+ self.config.anchor_channels_config.as_ref().map_or(0, |c| {
1095-
if init_features.requires_anchors_zero_fee_htlc_tx()
1096-
&& !c.trusted_peers_no_reserve.contains(&node_id)
1097-
{
1097+
if anchor_channel && !c.trusted_peers_no_reserve.contains(&node_id) {
10981098
c.per_channel_reserve_sats
10991099
} else {
11001100
0
@@ -1619,9 +1619,10 @@ pub(crate) fn total_anchor_channels_reserve_sats(
16191619
!anchor_channels_config.trusted_peers_no_reserve.contains(&c.counterparty.node_id)
16201620
&& c.channel_shutdown_state
16211621
.map_or(true, |s| s != ChannelShutdownState::ShutdownComplete)
1622-
&& c.channel_type
1623-
.as_ref()
1624-
.map_or(false, |t| t.requires_anchors_zero_fee_htlc_tx())
1622+
&& c.channel_type.as_ref().map_or(false, |t| {
1623+
t.requires_anchors_zero_fee_htlc_tx()
1624+
|| t.requires_anchor_zero_fee_commitments()
1625+
})
16251626
})
16261627
.count() as u64
16271628
* 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)