]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Drop `lightning-invoice` dependency on hashbrown` 2024-02-no-ahash
authorMatt Corallo <git@bluematt.me>
Tue, 13 Feb 2024 18:15:20 +0000 (18:15 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 16 Feb 2024 20:34:41 +0000 (20:34 +0000)
lightning-invoice/Cargo.toml
lightning-invoice/src/lib.rs
lightning-invoice/src/utils.rs

index 4376ac0dc70c943550600d8e748d5eb341473db8..1d2a4cdbfbe4ae2d0e3d106e541a3688b5c35ac5 100644 (file)
@@ -16,7 +16,7 @@ rustdoc-args = ["--cfg", "docsrs"]
 
 [features]
 default = ["std"]
-no-std = ["hashbrown", "lightning/no-std"]
+no-std = ["lightning/no-std"]
 std = ["bitcoin/std", "num-traits/std", "lightning/std", "bech32/std"]
 
 [dependencies]
@@ -24,7 +24,6 @@ bech32 = { version = "0.9.0", default-features = false }
 lightning = { version = "0.0.121", path = "../lightning", default-features = false }
 secp256k1 = { version = "0.27.0", default-features = false, features = ["recovery", "alloc"] }
 num-traits = { version = "0.2.8", default-features = false }
-hashbrown = { version = "0.13", optional = true }
 serde = { version = "1.0.118", optional = true }
 bitcoin = { version = "0.30.2", default-features = false }
 
@@ -32,3 +31,4 @@ bitcoin = { version = "0.30.2", default-features = false }
 lightning = { version = "0.0.121", path = "../lightning", default-features = false, features = ["_test_utils"] }
 hex = { package = "hex-conservative", version = "0.1.1", default-features = false }
 serde_json = { version = "1"}
+hashbrown = { version = "0.13", default-features = false }
index 610f739e57ad9d294610103edd36bbd5155d7109..9c6badad6d9962fb99800832fbb6849b2400270d 100644 (file)
@@ -79,14 +79,7 @@ mod tb;
 
 #[allow(unused_imports)]
 mod prelude {
-       #[cfg(feature = "hashbrown")]
-       extern crate hashbrown;
-
        pub use alloc::{vec, vec::Vec, string::String};
-       #[cfg(not(feature = "hashbrown"))]
-       pub use std::collections::{HashMap, hash_map};
-       #[cfg(feature = "hashbrown")]
-       pub use self::hashbrown::{HashMap, HashSet, hash_map};
 
        pub use alloc::string::ToString;
 }
index 5e8b72467e5da655cd9f77876ac692b948498833..d45a4e8e6462b4256333ea9f6973367b1d586c10 100644 (file)
@@ -16,6 +16,7 @@ use lightning::routing::gossip::RoutingFees;
 use lightning::routing::router::{RouteHint, RouteHintHop, Router};
 use lightning::util::logger::{Logger, Record};
 use secp256k1::PublicKey;
+use alloc::collections::{btree_map, BTreeMap};
 use core::ops::Deref;
 use core::time::Duration;
 use core::iter::Iterator;
@@ -603,7 +604,7 @@ fn sort_and_filter_channels<L: Deref>(
 where
        L::Target: Logger,
 {
-       let mut filtered_channels: HashMap<PublicKey, ChannelDetails> = HashMap::new();
+       let mut filtered_channels: BTreeMap<PublicKey, ChannelDetails> = BTreeMap::new();
        let min_inbound_capacity = min_inbound_capacity_msat.unwrap_or(0);
        let mut min_capacity_channel_exists = false;
        let mut online_channel_exists = false;
@@ -664,7 +665,7 @@ where
                }
 
                match filtered_channels.entry(channel.counterparty.node_id) {
-                       hash_map::Entry::Occupied(mut entry) => {
+                       btree_map::Entry::Occupied(mut entry) => {
                                let current_max_capacity = entry.get().inbound_capacity_msat;
                                // If this channel is public and the previous channel is not, ensure we replace the
                                // previous channel to avoid announcing non-public channels.
@@ -697,7 +698,7 @@ where
                                                channel.inbound_capacity_msat);
                                }
                        }
-                       hash_map::Entry::Vacant(entry) => {
+                       btree_map::Entry::Vacant(entry) => {
                                entry.insert(channel);
                        }
                }