Skip to content

Commit 05e7045

Browse files
committed
Include 0FC channels in anchor channel checks
1 parent 0657345 commit 05e7045

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
@@ -1157,7 +1157,8 @@ where
11571157
}
11581158
}
11591159

1160-
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx();
1160+
let anchor_channel = channel_type.requires_anchors_zero_fee_htlc_tx()
1161+
|| channel_type.requires_anchor_zero_fee_commitments();
11611162
if anchor_channel {
11621163
if let Some(anchor_channels_config) =
11631164
self.config.anchor_channels_config.as_ref()

src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,11 +1148,11 @@ impl Node {
11481148
.peer_by_node_id(peer_node_id)
11491149
.ok_or(Error::ConnectionFailed)?
11501150
.init_features;
1151+
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx()
1152+
|| init_features.requires_anchor_zero_fee_commitments();
11511153
let required_funds_sats = amount_sats
11521154
+ self.config.anchor_channels_config.as_ref().map_or(0, |c| {
1153-
if init_features.requires_anchors_zero_fee_htlc_tx()
1154-
&& !c.trusted_peers_no_reserve.contains(peer_node_id)
1155-
{
1155+
if anchor_channel && !c.trusted_peers_no_reserve.contains(peer_node_id) {
11561156
c.per_channel_reserve_sats
11571157
} else {
11581158
0
@@ -1827,9 +1827,10 @@ pub(crate) fn total_anchor_channels_reserve_sats(
18271827
!anchor_channels_config.trusted_peers_no_reserve.contains(&c.counterparty.node_id)
18281828
&& c.channel_shutdown_state
18291829
.map_or(true, |s| s != ChannelShutdownState::ShutdownComplete)
1830-
&& c.channel_type
1831-
.as_ref()
1832-
.map_or(false, |t| t.requires_anchors_zero_fee_htlc_tx())
1830+
&& c.channel_type.as_ref().map_or(false, |t| {
1831+
t.requires_anchors_zero_fee_htlc_tx()
1832+
|| t.requires_anchor_zero_fee_commitments()
1833+
})
18331834
})
18341835
.count() as u64
18351836
* anchor_channels_config.per_channel_reserve_sats

src/liquidity.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,9 +747,11 @@ where
747747
total_anchor_channels_reserve_sats(&self.channel_manager, &self.config);
748748
let spendable_amount_sats =
749749
self.wallet.get_spendable_amount_sats(cur_anchor_reserve_sats).unwrap_or(0);
750+
let anchor_channel = init_features.requires_anchors_zero_fee_htlc_tx()
751+
|| init_features.requires_anchor_zero_fee_commitments();
750752
let required_funds_sats = channel_amount_sats
751753
+ self.config.anchor_channels_config.as_ref().map_or(0, |c| {
752-
if init_features.requires_anchors_zero_fee_htlc_tx()
754+
if anchor_channel
753755
&& !c.trusted_peers_no_reserve.contains(&their_network_key)
754756
{
755757
c.per_channel_reserve_sats

0 commit comments

Comments
 (0)