Skip to content

Commit aa9cd4d

Browse files
committed
f swap control flow and fix test comment sp
1 parent 3028e88 commit aa9cd4d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lightning-invoice/src/utils.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -572,24 +572,24 @@ fn filter_channels<L: Deref>(
572572
let new_now_public = channel.is_public && !entry.get().is_public;
573573
let new_higher_capacity = channel.is_public == entry.get().is_public &&
574574
channel.inbound_capacity_msat > current_max_capacity;
575-
if !new_now_public && !new_higher_capacity {
575+
if new_now_public || new_higher_capacity {
576+
log_trace!(logger,
577+
"Preferring counterparty {} channel {} (SCID {:?}, {} msats) over {} (SCID {:?}, {} msats) for invoice route hints",
578+
log_pubkey!(channel.counterparty.node_id),
579+
log_bytes!(channel.channel_id), channel.short_channel_id,
580+
channel.inbound_capacity_msat,
581+
log_bytes!(entry.get().channel_id), entry.get().short_channel_id,
582+
current_max_capacity);
583+
entry.insert(channel);
584+
} else {
576585
log_trace!(logger,
577586
"Preferring counterparty {} channel {} (SCID {:?}, {} msats) over {} (SCID {:?}, {} msats) for invoice route hints",
578587
log_pubkey!(channel.counterparty.node_id),
579588
log_bytes!(entry.get().channel_id), entry.get().short_channel_id,
580589
current_max_capacity,
581590
log_bytes!(channel.channel_id), channel.short_channel_id,
582591
channel.inbound_capacity_msat);
583-
continue;
584592
}
585-
log_trace!(logger,
586-
"Preferring counterparty {} channel {} (SCID {:?}, {} msats) over {} (SCID {:?}, {} msats) for invoice route hints",
587-
log_pubkey!(channel.counterparty.node_id),
588-
log_bytes!(channel.channel_id), channel.short_channel_id,
589-
channel.inbound_capacity_msat,
590-
log_bytes!(entry.get().channel_id), entry.get().short_channel_id,
591-
current_max_capacity);
592-
entry.insert(channel);
593593
}
594594
hash_map::Entry::Vacant(entry) => {
595595
entry.insert(channel);
@@ -834,8 +834,8 @@ mod test {
834834
match_invoice_routes(Some(5000), &nodes[1], scid_aliases.clone());
835835

836836
// However after we mine the funding tx and exchange channel_ready messages for the public
837-
// channel we'll immediately switch to including it as a route hint, even though isn't yet
838-
// announced.
837+
// channel we'll immediately switch to including it as a route hint, even though it isn't
838+
// yet announced.
839839
let pub_channel_scid = mine_transaction(&nodes[0], &conf_tx);
840840
let node_a_pub_channel_ready = get_event_msg!(nodes[0], MessageSendEvent::SendChannelReady, nodes[1].node.get_our_node_id());
841841
nodes[1].node.handle_channel_ready(&nodes[0].node.get_our_node_id(), &node_a_pub_channel_ready);

0 commit comments

Comments
 (0)