Skip to content

Commit

Permalink
watchtower: Add get_winternitz_public_keys test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhunsen committed Dec 9, 2024
1 parent a6cbf15 commit 67dbb54
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
32 changes: 28 additions & 4 deletions core/src/watchtower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,36 @@ impl Watchtower {

#[cfg(test)]
mod tests {
use crate::{servers::create_actors_grpc, utils::initialize_logger};
use crate::{
mock::database::create_test_config_with_thread_name, servers::create_actors_grpc,
watchtower::Watchtower,
};

#[tokio::test]
async fn new_watchtower() {
initialize_logger(5).unwrap();
let (_verifiers, _operators, _aggregators, _watchtowers) =
create_actors_grpc("test_config.toml", 2).await;
let config = create_test_config_with_thread_name("test_config.toml", None).await;
let (_, _, _, _should_not_panic) = create_actors_grpc(config, 2).await;
}

#[tokio::test]
async fn get_winternitz_public_keys() {
let mut config = create_test_config_with_thread_name("test_config.toml", None).await;
let (verifiers, operators, _, _watchtowers) = create_actors_grpc(config.clone(), 2).await;

config.verifier_endpoints = Some(
verifiers
.iter()
.map(|v| format!("http://{}", v.0.to_string()))
.collect(),
);
config.operator_endpoints = Some(
operators
.iter()
.map(|o| format!("http://{}", o.0.to_string()))
.collect(),
);

let watchtower = Watchtower::new(config).await.unwrap();
let _winternitz_public_keys = watchtower.get_winternitz_public_keys().await.unwrap();
}
}
2 changes: 1 addition & 1 deletion core/tests/flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use clementine_core::mock::database::create_test_config_with_thread_name;
use clementine_core::rpc::clementine::clementine_aggregator_client::ClementineAggregatorClient;
use clementine_core::rpc::clementine::{self, DepositParams};
use clementine_core::servers::create_actors_grpc;
use clementine_core::utils::{SECP};
use clementine_core::utils::SECP;
use clementine_core::{traits::rpc::OperatorRpcClient, user::User};
use common::run_single_deposit;
use secp256k1::SecretKey;
Expand Down

0 comments on commit 67dbb54

Please sign in to comment.