From: Jeffrey Czyz Date: Mon, 10 Feb 2020 19:54:46 +0000 (-0800) Subject: Move Router test setup to a helper function X-Git-Tag: v0.0.12~140^2~1 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=71021fc9d8a6cffe792a906135e3c28c525444a7;p=rust-lightning Move Router test setup to a helper function --- 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: //