@@ -16,6 +16,7 @@ use lightning::routing::gossip::RoutingFees;
16
16
use lightning:: routing:: router:: { RouteHint , RouteHintHop , Router } ;
17
17
use lightning:: util:: logger:: { Logger , Record } ;
18
18
use secp256k1:: PublicKey ;
19
+ use alloc:: collections:: { btree_map, BTreeMap } ;
19
20
use core:: ops:: Deref ;
20
21
use core:: time:: Duration ;
21
22
use core:: iter:: Iterator ;
@@ -603,7 +604,7 @@ fn sort_and_filter_channels<L: Deref>(
603
604
where
604
605
L :: Target : Logger ,
605
606
{
606
- let mut filtered_channels: HashMap < PublicKey , ChannelDetails > = HashMap :: new ( ) ;
607
+ let mut filtered_channels: BTreeMap < PublicKey , ChannelDetails > = BTreeMap :: new ( ) ;
607
608
let min_inbound_capacity = min_inbound_capacity_msat. unwrap_or ( 0 ) ;
608
609
let mut min_capacity_channel_exists = false ;
609
610
let mut online_channel_exists = false ;
@@ -664,7 +665,7 @@ where
664
665
}
665
666
666
667
match filtered_channels. entry ( channel. counterparty . node_id ) {
667
- hash_map :: Entry :: Occupied ( mut entry) => {
668
+ btree_map :: Entry :: Occupied ( mut entry) => {
668
669
let current_max_capacity = entry. get ( ) . inbound_capacity_msat ;
669
670
// If this channel is public and the previous channel is not, ensure we replace the
670
671
// previous channel to avoid announcing non-public channels.
@@ -697,7 +698,7 @@ where
697
698
channel. inbound_capacity_msat) ;
698
699
}
699
700
}
700
- hash_map :: Entry :: Vacant ( entry) => {
701
+ btree_map :: Entry :: Vacant ( entry) => {
701
702
entry. insert ( channel) ;
702
703
}
703
704
}
0 commit comments