@@ -572,24 +572,24 @@ fn filter_channels<L: Deref>(
572
572
let new_now_public = channel. is_public && !entry. get ( ) . is_public ;
573
573
let new_higher_capacity = channel. is_public == entry. get ( ) . is_public &&
574
574
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 {
576
585
log_trace ! ( logger,
577
586
"Preferring counterparty {} channel {} (SCID {:?}, {} msats) over {} (SCID {:?}, {} msats) for invoice route hints" ,
578
587
log_pubkey!( channel. counterparty. node_id) ,
579
588
log_bytes!( entry. get( ) . channel_id) , entry. get( ) . short_channel_id,
580
589
current_max_capacity,
581
590
log_bytes!( channel. channel_id) , channel. short_channel_id,
582
591
channel. inbound_capacity_msat) ;
583
- continue ;
584
592
}
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) ;
593
593
}
594
594
hash_map:: Entry :: Vacant ( entry) => {
595
595
entry. insert ( channel) ;
@@ -834,8 +834,8 @@ mod test {
834
834
match_invoice_routes ( Some ( 5000 ) , & nodes[ 1 ] , scid_aliases. clone ( ) ) ;
835
835
836
836
// 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.
839
839
let pub_channel_scid = mine_transaction ( & nodes[ 0 ] , & conf_tx) ;
840
840
let node_a_pub_channel_ready = get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendChannelReady , nodes[ 1 ] . node. get_our_node_id( ) ) ;
841
841
nodes[ 1 ] . node . handle_channel_ready ( & nodes[ 0 ] . node . get_our_node_id ( ) , & node_a_pub_channel_ready) ;
0 commit comments