-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
156 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use clementine_core::{cli, extended_rpc::ExtendedRpc, servers::create_verifiers_and_operators}; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let config = cli::get_configuration(); | ||
let _rpc = ExtendedRpc::<bitcoincore_rpc::Client>::new( | ||
config.bitcoin_rpc_url.clone(), | ||
config.bitcoin_rpc_user.clone(), | ||
config.bitcoin_rpc_password.clone(), | ||
); | ||
|
||
let (operator_clients, verifier_clients, aggregator) = | ||
create_verifiers_and_operators("test_config.toml").await; | ||
|
||
println!( | ||
"OPERATOR_URLS={}", | ||
operator_clients | ||
.iter() | ||
.map(|(_, _, addr)| format!("http://localhost:{}", addr.port())) | ||
.collect::<Vec<_>>() | ||
.join(",") | ||
); | ||
println!( | ||
"VERIFIER_URLS={}", | ||
verifier_clients | ||
.iter() | ||
.map(|(_, _, addr)| format!("http://localhost:{}", addr.port())) | ||
.collect::<Vec<_>>() | ||
.join(",") | ||
); | ||
println!("AGGREGATOR_URL={}", aggregator.2); | ||
|
||
// Stop all servers | ||
for (_, handle, _) in operator_clients { | ||
handle.clone().stopped().await; | ||
} | ||
|
||
for (_, handle, _) in verifier_clients { | ||
handle.clone().stopped().await; | ||
} | ||
|
||
aggregator.1.stopped().await; | ||
|
||
println!("All servers stopped"); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#[cfg(feature = "aggregator_server")] | ||
use clementine_core::servers::create_aggregator_server; | ||
|
||
#[cfg(feature = "operator_server")] | ||
use clementine_core::servers::create_operator_server; | ||
|
||
#[cfg(feature = "verifier_server")] | ||
use clementine_core::servers::create_verifier_server; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
#[cfg(any( | ||
feature = "verifier_server", | ||
feature = "operator_server", | ||
feature = "aggregator_server" | ||
))] | ||
{ | ||
use clementine_core::{cli, database::common::Database, extended_rpc::ExtendedRpc}; | ||
|
||
let mut config = cli::get_configuration(); | ||
let rpc = ExtendedRpc::<bitcoincore_rpc::Client>::new( | ||
config.bitcoin_rpc_url.clone(), | ||
config.bitcoin_rpc_user.clone(), | ||
config.bitcoin_rpc_password.clone(), | ||
); | ||
|
||
let database = Database::new(config.clone()).await.unwrap(); | ||
database.init_from_schema().await.unwrap(); | ||
database.close().await; | ||
|
||
let mut handles = vec![]; | ||
|
||
#[cfg(feature = "verifier_server")] | ||
{ | ||
handles.push( | ||
create_verifier_server(config.clone(), rpc.clone()) | ||
.await | ||
.unwrap() | ||
.1 | ||
.stopped(), | ||
); | ||
config.port += 1; | ||
} | ||
|
||
#[cfg(feature = "operator_server")] | ||
{ | ||
handles.push( | ||
create_operator_server(config.clone(), rpc.clone()) | ||
.await | ||
.unwrap() | ||
.1 | ||
.stopped(), | ||
); | ||
config.port += 1; | ||
} | ||
|
||
#[cfg(feature = "aggregator_server")] | ||
handles.push(create_aggregator_server(config).await.unwrap().1.stopped()); | ||
|
||
futures::future::join_all(handles).await; | ||
} | ||
|
||
#[cfg(not(any( | ||
feature = "verifier_server", | ||
feature = "operator_server", | ||
feature = "aggregator_server" | ||
)))] | ||
{ | ||
println!("No server features are enabled. Exiting..."); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters