From 71021fc9d8a6cffe792a906135e3c28c525444a7 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Mon, 10 Feb 2020 11:54:46 -0800 Subject: [PATCH] Move Router test setup to a helper function --- lightning/src/ln/router.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lightning/src/ln/router.rs b/lightning/src/ln/router.rs index 1791bb6f5..d772ebc1a 100644 --- a/lightning/src/ln/router.rs +++ b/lightning/src/ln/router.rs @@ -1064,17 +1064,23 @@ mod tests { use hex; use secp256k1::key::{PublicKey,SecretKey}; + use secp256k1::All; use secp256k1::Secp256k1; use std::sync::Arc; - #[test] - fn route_test() { + fn create_router() -> (Secp256k1, PublicKey, Router) { let secp_ctx = Secp256k1::new(); let our_id = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&hex::decode("0101010101010101010101010101010101010101010101010101010101010101").unwrap()[..]).unwrap()); let logger: Arc = Arc::new(test_utils::TestLogger::new()); let chain_monitor = Arc::new(chaininterface::ChainWatchInterfaceUtil::new(Network::Testnet, Arc::clone(&logger))); let router = Router::new(our_id, chain_monitor, Arc::clone(&logger)); + (secp_ctx, our_id, router) + } + + #[test] + fn route_test() { + let (secp_ctx, our_id, router) = create_router(); // Build network from our_id to node8: // -- 2.39.5