X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Frouting%2Ftest_utils.rs;h=68264207f589e249fd90bde0a6d00298c2621b74;hb=ca9ca75f082dec8dfc70f3e263a7c3789e17a054;hp=a5d2af43c6ccbf90d04a6274d997c34689d03247;hpb=f4f1093edc506314484c8d52a40dd155e692394b;p=rust-lightning diff --git a/lightning/src/routing/test_utils.rs b/lightning/src/routing/test_utils.rs index a5d2af43..68264207 100644 --- a/lightning/src/routing/test_utils.rs +++ b/lightning/src/routing/test_utils.rs @@ -27,13 +27,15 @@ use bitcoin::secp256k1::{Secp256k1, All}; use crate::prelude::*; use crate::sync::{self, Arc}; +use crate::routing::gossip::NodeId; + // Using the same keys for LN and BTC ids pub(super) fn add_channel( gossip_sync: &P2PGossipSync>>, Arc, Arc>, secp_ctx: &Secp256k1, node_1_privkey: &SecretKey, node_2_privkey: &SecretKey, features: ChannelFeatures, short_channel_id: u64 ) { - let node_id_1 = PublicKey::from_secret_key(&secp_ctx, node_1_privkey); - let node_id_2 = PublicKey::from_secret_key(&secp_ctx, node_2_privkey); + let node_id_1 = NodeId::from_pubkey(&PublicKey::from_secret_key(&secp_ctx, node_1_privkey)); + let node_id_2 = NodeId::from_pubkey(&PublicKey::from_secret_key(&secp_ctx, node_2_privkey)); let unsigned_announcement = UnsignedChannelAnnouncement { features, @@ -64,7 +66,7 @@ pub(super) fn add_or_update_node( gossip_sync: &P2PGossipSync>>, Arc, Arc>, secp_ctx: &Secp256k1, node_privkey: &SecretKey, features: NodeFeatures, timestamp: u32 ) { - let node_id = PublicKey::from_secret_key(&secp_ctx, node_privkey); + let node_id = NodeId::from_pubkey(&PublicKey::from_secret_key(&secp_ctx, node_privkey)); let unsigned_announcement = UnsignedNodeAnnouncement { features, timestamp, @@ -139,8 +141,7 @@ pub(super) fn build_line_graph() -> ( let secp_ctx = Secp256k1::new(); let logger = Arc::new(test_utils::TestLogger::new()); let chain_monitor = Arc::new(test_utils::TestChainSource::new(Network::Testnet)); - let genesis_hash = genesis_block(Network::Testnet).header.block_hash(); - let network_graph = Arc::new(NetworkGraph::new(genesis_hash, Arc::clone(&logger))); + 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)); // Build network from our_id to node 19: @@ -193,8 +194,7 @@ pub(super) fn build_graph() -> ( let secp_ctx = Secp256k1::new(); let logger = Arc::new(test_utils::TestLogger::new()); let chain_monitor = Arc::new(test_utils::TestChainSource::new(Network::Testnet)); - let genesis_hash = genesis_block(Network::Testnet).header.block_hash(); - let network_graph = Arc::new(NetworkGraph::new(genesis_hash, Arc::clone(&logger))); + 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)); // Build network from our_id to node6: //