]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Drop unnecessary key derivation in route tests 2024-06-real-bench
authorMatt Corallo <git@bluematt.me>
Wed, 12 Jun 2024 14:06:54 +0000 (14:06 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 12 Jun 2024 19:35:06 +0000 (19:35 +0000)
In our route tests we need some "random" bytes for the router to
randomize amounts using. We generate this by building an actual
`KeysManager` and then deriving some random bytes using the
`EntropySource` trait. However, `get_route` (what we're normally
testing) doesn't actually use the random bytes, and even if it did,
using a `KeysManager` is just a fancy way of creating a constant,
so there's really no reason to do all the fancy crypto.

Instead, here, we change our routing tests and benchmarks to simply
use `[42; 32]` as the "random" bytes.

lightning/src/routing/router.rs

index 207b0903e6183056824fcc97c1b116de3f1f3c4d..f464c096eed587fd2e1776545b0fa475a4dfc68c 100644 (file)
@@ -3321,7 +3321,6 @@ mod tests {
        use crate::routing::scoring::{ChannelUsage, FixedPenaltyScorer, ScoreLookUp, ProbabilisticScorer, ProbabilisticScoringFeeParameters, ProbabilisticScoringDecayParameters};
        use crate::routing::test_utils::{add_channel, add_or_update_node, build_graph, build_line_graph, id_to_feature_flags, get_nodes, update_channel};
        use crate::chain::transaction::OutPoint;
-       use crate::sign::EntropySource;
        use crate::ln::channel_state::{ChannelCounterparty, ChannelDetails, ChannelShutdownState};
        use crate::ln::types::ChannelId;
        use crate::ln::features::{BlindedHopFeatures, ChannelFeatures, InitFeatures, NodeFeatures};
@@ -3396,8 +3395,7 @@ mod tests {
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let mut payment_params = PaymentParameters::from_node_id(nodes[2], 42);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // Simple route to 2 via 1
 
@@ -3440,8 +3438,7 @@ mod tests {
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // Simple route to 2 via 1
 
@@ -3465,8 +3462,7 @@ mod tests {
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // Simple route to 2 via 1
 
@@ -3600,8 +3596,7 @@ mod tests {
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config))
                        .unwrap();
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // A route to node#2 via two paths.
                // One path allows transferring 35-40 sats, another one also allows 35-40 sats.
@@ -3746,8 +3741,7 @@ mod tests {
                let config = UserConfig::default();
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42).with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config)).unwrap();
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // Route to node2 over a single path which requires overpaying the recipient themselves.
 
@@ -3806,8 +3800,7 @@ mod tests {
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // // Disable channels 4 and 12 by flags=2
                update_channel(&gossip_sync, &secp_ctx, &privkeys[1], UnsignedChannelUpdate {
@@ -3873,8 +3866,7 @@ mod tests {
                let (_, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // Disable nodes 1, 2, and 8 by requiring unknown feature bits
                let mut unknown_features = NodeFeatures::empty();
@@ -3923,8 +3915,7 @@ mod tests {
                let (secp_ctx, network_graph, _, _, logger) = build_graph();
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // Route to 1 via 2 and 3 because our channel to 1 is disabled
                let payment_params = PaymentParameters::from_node_id(nodes[0], 42);
@@ -4060,8 +4051,7 @@ mod tests {
                let (secp_ctx, network_graph, _, _, logger) = build_graph();
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // Simple test across 2, 3, 5, and 4 via a last_hop channel
                // Tests the behaviour when the RouteHint contains a suboptimal hop.
@@ -4169,8 +4159,7 @@ mod tests {
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let payment_params = PaymentParameters::from_node_id(nodes[6], 42).with_route_hints(empty_last_hop(&nodes)).unwrap();
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // Test handling of an empty RouteHint passed in Invoice.
                let route_params = RouteParameters::from_payment_params_and_value(payment_params, 100);
@@ -4250,8 +4239,8 @@ mod tests {
                let last_hops = multi_hop_last_hops_hint([nodes[2], nodes[3]]);
                let payment_params = PaymentParameters::from_node_id(nodes[6], 42).with_route_hints(last_hops.clone()).unwrap();
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
+
                // Test through channels 2, 3, 0xff00, 0xff01.
                // Test shows that multi-hop route hints are considered and factored correctly into the
                // max path length.
@@ -4439,8 +4428,8 @@ mod tests {
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let payment_params = PaymentParameters::from_node_id(nodes[6], 42).with_route_hints(last_hops_with_public_channel(&nodes)).unwrap();
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
+
                // This test shows that public routes can be present in the invoice
                // which would be handled in the same manner.
 
@@ -4492,8 +4481,7 @@ mod tests {
                let (secp_ctx, network_graph, _, _, logger) = build_graph();
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // Simple test with outbound channel to 4 to test that last_hops and first_hops connect
                let our_chans = vec![get_channel_details(Some(42), nodes[3].clone(), InitFeatures::from_le_bytes(vec![0b11]), 250_000_000)];
@@ -4625,8 +4613,7 @@ mod tests {
                let payment_params = PaymentParameters::from_node_id(target_node_id, 42).with_route_hints(vec![last_hops]).unwrap();
                let our_chans = vec![get_channel_details(Some(42), middle_node_id, InitFeatures::from_le_bytes(vec![0b11]), outbound_capacity_msat)];
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let logger = ln_test_utils::TestLogger::new();
                let network_graph = NetworkGraph::new(Network::Testnet, &logger);
                let route_params = RouteParameters::from_payment_params_and_value(payment_params, route_val);
@@ -4687,8 +4674,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, chain_monitor, logger) = build_graph();
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42)
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config))
@@ -4997,8 +4983,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, _, logger) = build_graph();
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
                let payment_params = PaymentParameters::from_node_id(nodes[3], 42)
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config))
@@ -5134,8 +5119,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, _, logger) = build_graph();
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42);
 
                // Path via node0 is channels {1, 3}. Limit them to 100 and 50 sats (total limit 50).
@@ -5241,8 +5225,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, _, logger) = build_graph();
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // We need a route consisting of 3 paths:
                // From our node to node2 via node0, node7, node1 (three paths one hop each).
@@ -5431,8 +5414,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, _, logger) = build_graph();
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
                let payment_params = PaymentParameters::from_node_id(nodes[3], 42)
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config))
@@ -5616,8 +5598,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, _, logger) = build_graph();
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
                let payment_params = PaymentParameters::from_node_id(nodes[3], 42)
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config))
@@ -5803,8 +5784,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, _, logger) = build_graph();
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
                let payment_params = PaymentParameters::from_node_id(nodes[3], 42)
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config))
@@ -6016,8 +5996,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, _, logger) = build_graph();
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
                let payment_params = PaymentParameters::from_node_id(PublicKey::from_slice(&[02; 33]).unwrap(), 42)
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config)).unwrap()
@@ -6112,8 +6091,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, _, logger) = build_graph();
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42)
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config))
@@ -6284,8 +6262,7 @@ mod tests {
                let gossip_sync = P2PGossipSync::new(Arc::clone(&network), None, Arc::clone(&logger));
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let payment_params = PaymentParameters::from_node_id(nodes[6], 42);
 
                add_channel(&gossip_sync, &secp_ctx, &our_privkey, &privkeys[1], ChannelFeatures::from_le_bytes(id_to_feature_flags(6)), 6);
@@ -6430,8 +6407,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, _, logger) = build_graph();
                let (our_privkey, our_id, _, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42);
 
                // We modify the graph to set the htlc_maximum of channel 2 to below the value we wish to
@@ -6498,8 +6474,7 @@ mod tests {
                let (secp_ctx, network_graph, gossip_sync, _, logger) = build_graph();
                let (our_privkey, our_id, privkeys, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42)
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config))
@@ -6578,8 +6553,7 @@ mod tests {
                let payment_params = PaymentParameters::from_node_id(nodes[0], 42)
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config))
                        .unwrap();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                {
                        let route_params = RouteParameters::from_payment_params_and_value(
@@ -6653,8 +6627,7 @@ mod tests {
 
                // Without penalizing each hop 100 msats, a longer path with lower fees is chosen.
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let route_params = RouteParameters::from_payment_params_and_value(
                        payment_params.clone(), 100);
                let route = get_route( &our_id, &route_params, &network_graph.read_only(), None,
@@ -6719,8 +6692,7 @@ mod tests {
 
                // A path to nodes[6] exists when no penalties are applied to any channel.
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let route_params = RouteParameters::from_payment_params_and_value(
                        payment_params, 100);
                let route = get_route( &our_id, &route_params, &network_graph, None, Arc::clone(&logger),
@@ -6835,8 +6807,7 @@ mod tests {
                let feasible_max_total_cltv_delta = 1008;
                let feasible_payment_params = PaymentParameters::from_node_id(nodes[6], 0).with_route_hints(last_hops(&nodes)).unwrap()
                        .with_max_total_cltv_expiry_delta(feasible_max_total_cltv_delta);
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let route_params = RouteParameters::from_payment_params_and_value(
                        feasible_payment_params, 100);
                let route = get_route(&our_id, &route_params, &network_graph, None, Arc::clone(&logger),
@@ -6871,8 +6842,7 @@ mod tests {
                let scorer = ln_test_utils::TestScorer::new();
                let mut payment_params = PaymentParameters::from_node_id(nodes[6], 0).with_route_hints(last_hops(&nodes)).unwrap()
                        .with_max_path_count(1);
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // We should be able to find a route initially, and then after we fail a few random
                // channels eventually we won't be able to any longer.
@@ -6903,8 +6873,7 @@ mod tests {
                let network_graph = network.read_only();
 
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                // First check we can actually create a long route on this graph.
                let feasible_payment_params = PaymentParameters::from_node_id(nodes[18], 0);
@@ -6937,8 +6906,7 @@ mod tests {
                let scorer = ln_test_utils::TestScorer::new();
 
                let payment_params = PaymentParameters::from_node_id(nodes[6], 42).with_route_hints(last_hops(&nodes)).unwrap();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let route_params = RouteParameters::from_payment_params_and_value(
                        payment_params.clone(), 100);
                let route = get_route(&our_id, &route_params, &network_graph.read_only(), None,
@@ -6973,8 +6941,7 @@ mod tests {
                let network_channels = network_graph.channels();
                let scorer = ln_test_utils::TestScorer::new();
                let payment_params = PaymentParameters::from_node_id(nodes[3], 0);
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[4u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                let route_params = RouteParameters::from_payment_params_and_value(
                        payment_params.clone(), 100);
@@ -7038,9 +7005,7 @@ mod tests {
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let network_graph = network.read_only();
 
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
-
+               let random_seed_bytes = [42; 32];
                let payment_params = PaymentParameters::from_node_id(nodes[3], 0);
                let hops = [nodes[1], nodes[2], nodes[4], nodes[3]];
                let route_params = RouteParameters::from_payment_params_and_value(payment_params, 100);
@@ -7091,8 +7056,8 @@ mod tests {
                let payment_params = PaymentParameters::from_node_id(nodes[2], 42)
                        .with_bolt11_features(channelmanager::provided_bolt11_invoice_features(&config))
                        .unwrap();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
+
                // 100,000 sats is less than the available liquidity on each channel, set above.
                let route_params = RouteParameters::from_payment_params_and_value(
                        payment_params, 100_000_000);
@@ -7177,9 +7142,7 @@ mod tests {
                let (secp_ctx, network_graph, _, _, logger) = build_line_graph();
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
 
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
-
+               let random_seed_bytes = [42; 32];
                let mut scorer_params = ProbabilisticScoringFeeParameters::default();
                let scorer = ProbabilisticScorer::new(ProbabilisticScoringDecayParameters::default(), Arc::clone(&network_graph), Arc::clone(&logger));
 
@@ -7228,8 +7191,7 @@ mod tests {
                let netgraph = network_graph.read_only();
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                let max_htlc_msat = 50_000;
@@ -7286,8 +7248,7 @@ mod tests {
                let logger = Arc::new(ln_test_utils::TestLogger::new());
                let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, Arc::clone(&logger)));
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                let our_node_id = ln_test_utils::pubkey(42);
@@ -7549,8 +7510,7 @@ mod tests {
                let network_graph = network.read_only();
 
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                let mut blinded_path = BlindedPath {
                        introduction_node: IntroductionNode::NodeId(nodes[2]),
@@ -7607,8 +7567,7 @@ mod tests {
                let network_graph = network.read_only();
 
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                let mut invalid_blinded_path = BlindedPath {
                        introduction_node: IntroductionNode::NodeId(nodes[2]),
@@ -7676,8 +7635,7 @@ mod tests {
                let network_graph = network.read_only();
 
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                let bolt12_features = channelmanager::provided_bolt12_invoice_features(&config);
@@ -7744,8 +7702,7 @@ mod tests {
                let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, Arc::clone(&logger)));
                let gossip_sync = P2PGossipSync::new(Arc::clone(&network_graph), None, Arc::clone(&logger));
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                let amt_msat = 10_000_000;
                let (_, _, privkeys, nodes) = get_nodes(&secp_ctx);
@@ -7836,8 +7793,7 @@ mod tests {
                let logger = Arc::new(ln_test_utils::TestLogger::new());
                let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, Arc::clone(&logger)));
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                // Values are taken from the fuzz input that uncovered this panic.
@@ -7896,8 +7852,7 @@ mod tests {
                let (secp_ctx, network_graph, _, _, logger) = build_graph();
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                // Values are taken from the fuzz input that uncovered this panic.
@@ -7948,8 +7903,7 @@ mod tests {
                let (secp_ctx, network_graph, _, _, logger) = build_graph();
                let (_, our_id, _, nodes) = get_nodes(&secp_ctx);
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                // Values are taken from the fuzz input that uncovered this panic.
@@ -8010,8 +7964,7 @@ mod tests {
                let logger = Arc::new(ln_test_utils::TestLogger::new());
                let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, Arc::clone(&logger)));
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                // Values are taken from the fuzz input that uncovered this panic.
@@ -8090,8 +8043,7 @@ mod tests {
                let logger = Arc::new(ln_test_utils::TestLogger::new());
                let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, Arc::clone(&logger)));
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                // Values are taken from the fuzz input that uncovered this panic.
@@ -8172,8 +8124,7 @@ mod tests {
                let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, Arc::clone(&logger)));
                let gossip_sync = P2PGossipSync::new(network_graph.clone(), None, logger.clone());
                let scorer = ProbabilisticScorer::new(ProbabilisticScoringDecayParameters::default(), network_graph.clone(), logger.clone());
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                // Values are taken from the fuzz input that uncovered this panic.
@@ -8242,8 +8193,7 @@ mod tests {
                let logger = Arc::new(ln_test_utils::TestLogger::new());
                let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, Arc::clone(&logger)));
                let scorer = ProbabilisticScorer::new(ProbabilisticScoringDecayParameters::default(), network_graph.clone(), logger.clone());
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                // Values are taken from the fuzz input that uncovered this panic.
@@ -8302,8 +8252,7 @@ mod tests {
                let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, Arc::clone(&logger)));
                let gossip_sync = P2PGossipSync::new(Arc::clone(&network_graph), None, Arc::clone(&logger));
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                let amt_msat = 1_000_000;
@@ -8446,8 +8395,7 @@ mod tests {
                let logger = Arc::new(ln_test_utils::TestLogger::new());
                let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, Arc::clone(&logger)));
                let scorer = ln_test_utils::TestScorer::new();
-               let keys_manager = ln_test_utils::TestKeysInterface::new(&[0u8; 32], Network::Testnet);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
                let config = UserConfig::default();
 
                let (_, our_node_id, _, nodes) = get_nodes(&secp_ctx);
@@ -8501,7 +8449,6 @@ pub(crate) mod bench_utils {
 
        use crate::chain::transaction::OutPoint;
        use crate::routing::scoring::{ProbabilisticScorer, ScoreUpdate};
-       use crate::sign::KeysManager;
        use crate::ln::channel_state::{ChannelCounterparty, ChannelShutdownState};
        use crate::ln::channelmanager;
        use crate::ln::types::ChannelId;
@@ -8616,8 +8563,7 @@ pub(crate) mod bench_utils {
                starting_amount: u64, route_count: usize,
        ) -> Vec<(ChannelDetails, PaymentParameters, u64)> {
                let payer = payer_pubkey();
-               let keys_manager = KeysManager::new(&[0u8; 32], 42, 42);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                let nodes = graph.read_only().nodes().clone();
                let mut route_endpoints = Vec::new();
@@ -8653,7 +8599,6 @@ pub(crate) mod bench_utils {
 pub mod benches {
        use super::*;
        use crate::routing::scoring::{ScoreUpdate, ScoreLookUp};
-       use crate::sign::{EntropySource, KeysManager};
        use crate::ln::channelmanager;
        use crate::ln::features::Bolt11InvoiceFeatures;
        use crate::routing::gossip::NetworkGraph;
@@ -8761,8 +8706,7 @@ pub mod benches {
                route_endpoints: Vec<(ChannelDetails, PaymentParameters, u64)>,
        ) {
                let payer = bench_utils::payer_pubkey();
-               let keys_manager = KeysManager::new(&[0u8; 32], 42, 42);
-               let random_seed_bytes = keys_manager.get_secure_random_bytes();
+               let random_seed_bytes = [42; 32];
 
                let mut idx = 0;
                bench.bench_function(bench_name, |b| b.iter(|| {