Skip to content

Commit 02564cc

Browse files
committed
Include 0FC channels in anchor channel checks
1 parent 723b711 commit 02564cc

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
@@ -1076,7 +1076,8 @@ where
10761076
}
10771077
}
10781078

1079-
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx();
1079+
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx()
1080+
|| channel_type.requires_anchor_zero_fee_commitments();
10801081
if anchor_channel {
10811082
if let Some(anchor_channels_config) =
10821083
self.config.anchor_channels_config.as_ref()

src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,11 +1085,11 @@ impl Node {
10851085
.peer_by_node_id(&node_id)
10861086
.ok_or(Error::ConnectionFailed)?
10871087
.init_features;
1088+
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx()
1089+
|| init_features.requires_anchor_zero_fee_commitments();
10881090
let required_funds_sats = channel_amount_sats
10891091
+ self.config.anchor_channels_config.as_ref().map_or(0, |c| {
1090-
if init_features.requires_anchors_zero_fee_htlc_tx()
1091-
&& !c.trusted_peers_no_reserve.contains(&node_id)
1092-
{
1092+
if anchor_channel && !c.trusted_peers_no_reserve.contains(&node_id) {
10931093
c.per_channel_reserve_sats
10941094
} else {
10951095
0
@@ -1614,9 +1614,10 @@ pub(crate) fn total_anchor_channels_reserve_sats(
16141614
!anchor_channels_config.trusted_peers_no_reserve.contains(&c.counterparty.node_id)
16151615
&& c.channel_shutdown_state
16161616
.map_or(true, |s| s != ChannelShutdownState::ShutdownComplete)
1617-
&& c.channel_type
1618-
.as_ref()
1619-
.map_or(false, |t| t.requires_anchors_zero_fee_htlc_tx())
1617+
&& c.channel_type.as_ref().map_or(false, |t| {
1618+
t.requires_anchors_zero_fee_htlc_tx()
1619+
|| t.requires_anchor_zero_fee_commitments()
1620+
})
16201621
})
16211622
.count() as u64
16221623
* 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)