use prelude::*;
use alloc::collections::BinaryHeap;
use core::cmp;
-use std::collections::HashMap;
use core::ops::Deref;
/// A hop in a route
}
impl_writeable_tlv_based!(RouteHop, {
- (0, pubkey),
- (2, node_features),
- (4, short_channel_id),
- (6, channel_features),
- (8, fee_msat),
- (10, cltv_expiry_delta),
-}, {}, {});
+ (0, pubkey, required),
+ (2, node_features, required),
+ (4, short_channel_id, required),
+ (6, channel_features, required),
+ (8, fee_msat, required),
+ (10, cltv_expiry_delta, required),
+});
/// A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
/// it can take multiple paths. Each path is composed of one or more hops through the network.
hop.write(writer)?;
}
}
- write_tlv_fields!(writer, {}, {});
+ write_tlv_fields!(writer, {});
Ok(())
}
}
}
paths.push(hops);
}
- read_tlv_fields!(reader, {}, {});
+ read_tlv_fields!(reader, {});
Ok(Route { paths })
}
}
}
}
+ #[cfg(not(feature = "no_std"))]
pub(super) fn random_init_seed() -> u64 {
// Because the default HashMap in std pulls OS randomness, we can use it as a (bad) RNG.
use core::hash::{BuildHasher, Hasher};
println!("Using seed of {}", seed);
seed
}
+ #[cfg(not(feature = "no_std"))]
use util::ser::Readable;
#[test]
+ #[cfg(not(feature = "no_std"))]
fn generate_routes() {
let mut d = match super::test_utils::get_route_file() {
Ok(f) => f,
}
#[test]
+ #[cfg(not(feature = "no_std"))]
fn generate_routes_mpp() {
let mut d = match super::test_utils::get_route_file() {
Ok(f) => f,
}
}
-#[cfg(test)]
+#[cfg(all(test, not(feature = "no_std")))]
pub(crate) mod test_utils {
use std::fs::File;
/// Tries to open a network graph file, or panics with a URL to fetch it.
}
}
-#[cfg(all(test, feature = "unstable"))]
+#[cfg(all(test, feature = "unstable", not(feature = "no_std")))]
mod benches {
use super::*;
use util::logger::{Logger, Record};