@@ -16,6 +16,7 @@ use lightning::routing::gossip::RoutingFees;
1616use lightning:: routing:: router:: { RouteHint , RouteHintHop , Router } ;
1717use lightning:: util:: logger:: { Logger , Record } ;
1818use secp256k1:: PublicKey ;
19+ use alloc:: collections:: { btree_map, BTreeMap } ;
1920use core:: ops:: Deref ;
2021use core:: time:: Duration ;
2122use core:: iter:: Iterator ;
@@ -603,7 +604,7 @@ fn sort_and_filter_channels<L: Deref>(
603604where
604605 L :: Target : Logger ,
605606{
606- let mut filtered_channels: HashMap < PublicKey , ChannelDetails > = HashMap :: new ( ) ;
607+ let mut filtered_channels: BTreeMap < PublicKey , ChannelDetails > = BTreeMap :: new ( ) ;
607608 let min_inbound_capacity = min_inbound_capacity_msat. unwrap_or ( 0 ) ;
608609 let mut min_capacity_channel_exists = false ;
609610 let mut online_channel_exists = false ;
@@ -664,7 +665,7 @@ where
664665 }
665666
666667 match filtered_channels. entry ( channel. counterparty . node_id ) {
667- hash_map :: Entry :: Occupied ( mut entry) => {
668+ btree_map :: Entry :: Occupied ( mut entry) => {
668669 let current_max_capacity = entry. get ( ) . inbound_capacity_msat ;
669670 // If this channel is public and the previous channel is not, ensure we replace the
670671 // previous channel to avoid announcing non-public channels.
@@ -697,7 +698,7 @@ where
697698 channel. inbound_capacity_msat) ;
698699 }
699700 }
700- hash_map :: Entry :: Vacant ( entry) => {
701+ btree_map :: Entry :: Vacant ( entry) => {
701702 entry. insert ( channel) ;
702703 }
703704 }
0 commit comments