@@ -262,7 +262,7 @@ where
262
262
LoggerRef :: Target : Logger ,
263
263
PersistRef :: Target : Persist < ChannelSigner > ,
264
264
{
265
- let mut anchor_channels_with_balance = new_hash_set ( ) ;
265
+ let mut anchor_channels = new_hash_set ( ) ;
266
266
// Calculate the number of in-progress anchor channels by inspecting ChannelMonitors with balance.
267
267
// This includes channels that are in the process of being resolved on-chain.
268
268
for ( outpoint, channel_id) in chain_monitor. list_monitors ( ) {
@@ -274,18 +274,17 @@ where
274
274
if channel_monitor. channel_type_features ( ) . supports_anchors_zero_fee_htlc_tx ( )
275
275
&& !channel_monitor. get_claimable_balances ( ) . is_empty ( )
276
276
{
277
- anchor_channels_with_balance . insert ( channel_id) ;
277
+ anchor_channels . insert ( channel_id) ;
278
278
}
279
279
}
280
- // Count channels that are in the middle of negotiation as well.
281
- let num_anchor_channels = anchor_channels_with_balance. len ( )
282
- + a_channel_manager
283
- . get_cm ( )
284
- . list_channels ( )
285
- . into_iter ( )
286
- . filter ( |c| c. channel_type . is_none ( ) )
287
- . count ( ) ;
288
- get_supportable_anchor_channels ( context, utxos) > num_anchor_channels as u64
280
+ // Also include channels that are in the middle of negotiation or anchor channels that don't have
281
+ // a ChannelMonitor yet.
282
+ for channel in a_channel_manager. get_cm ( ) . list_channels ( ) {
283
+ if channel. channel_type . map_or ( true , |ct| ct. supports_anchors_zero_fee_htlc_tx ( ) ) {
284
+ anchor_channels. insert ( channel. channel_id ) ;
285
+ }
286
+ }
287
+ get_supportable_anchor_channels ( context, utxos) > anchor_channels. len ( ) as u64
289
288
}
290
289
291
290
#[ cfg( test) ]
0 commit comments