From 1fd6c674b15f5c942052d6d69e07a6b9e9d8979b Mon Sep 17 00:00:00 2001 From: Arik Sosman Date: Wed, 27 Mar 2024 23:48:08 -0700 Subject: [PATCH] Test NodeAnnouncement persistence. --- src/tests/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 578fa9f..b967608 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -47,10 +47,10 @@ pub(crate) fn db_test_schema() -> String { }) } -fn generate_node_announcement() -> NodeAnnouncement { +fn generate_node_announcement(private_key: Option) -> NodeAnnouncement { let secp_context = Secp256k1::new(); - let random_private_key = SecretKey::from_slice(&[1; 32]).unwrap(); + let random_private_key = private_key.unwrap_or(SecretKey::from_slice(&[1; 32]).unwrap()); let random_public_key = random_private_key.public_key(&secp_context); let node_id = NodeId::from_pubkey(&random_public_key); @@ -302,7 +302,7 @@ async fn test_node_announcement_persistence() { let (mut persister, receiver) = GossipPersister::new(network_graph_arc.clone(), logger.clone()); { // seed the db - let mut announcement = generate_node_announcement(); + let mut announcement = generate_node_announcement(None); receiver.send(GossipMessage::NodeAnnouncement(announcement.clone(), None)).await.unwrap(); receiver.send(GossipMessage::NodeAnnouncement(announcement.clone(), Some(12345))).await.unwrap(); -- 2.39.5