Skip to content

Commit

Permalink
Merge branch 'development' into network-domain-hashers
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden authored Nov 28, 2023
2 parents dd4245a + c54478f commit b931592
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 103 deletions.
119 changes: 26 additions & 93 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions applications/minotari_console_wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ tari_features = { path = "../../common/tari_features"}

[features]
libtor = ["tari_libtor"]
grpc = []

[package.metadata.cargo-machete]
# We need to specify extra features for log4rs even though it is not used directly in this crate
Expand Down
31 changes: 23 additions & 8 deletions applications/minotari_console_wallet/src/wallet_modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ pub fn tui_mode(
mut wallet: WalletSqlite,
) -> Result<(), ExitError> {
let (events_broadcaster, _events_listener) = broadcast::channel(100);

if config.grpc_enabled {
#[cfg(feature = "grpc")]
if let Some(address) = config.grpc_address.clone() {
let grpc = WalletGrpcServer::new(wallet.clone()).map_err(|e| ExitError {
exit_code: ExitCode::UnknownError,
Expand All @@ -281,6 +283,11 @@ pub fn tui_mode(
wallet.clone(),
));
}
#[cfg(not(feature = "grpc"))]
return Err(ExitError::new(
ExitCode::GrpcError,
"gRPC server is enabled but not supported in this build",
));
}

let notifier = Notifier::new(
Expand Down Expand Up @@ -377,14 +384,22 @@ pub fn recovery_mode(
pub fn grpc_mode(handle: Handle, config: &WalletConfig, wallet: WalletSqlite) -> Result<(), ExitError> {
info!(target: LOG_TARGET, "Starting grpc server");
if let Some(address) = config.grpc_address.as_ref().filter(|_| config.grpc_enabled).cloned() {
let grpc = WalletGrpcServer::new(wallet.clone()).map_err(|e| ExitError {
exit_code: ExitCode::UnknownError,
details: Some(e.to_string()),
})?;
let auth = config.grpc_authentication.clone();
handle
.block_on(run_grpc(grpc, address, auth, wallet))
.map_err(|e| ExitError::new(ExitCode::GrpcError, e))?;
#[cfg(feature = "grpc")]
{
let grpc = WalletGrpcServer::new(wallet.clone()).map_err(|e| ExitError {
exit_code: ExitCode::UnknownError,
details: Some(e.to_string()),
})?;
let auth = config.grpc_authentication.clone();
handle
.block_on(run_grpc(grpc, address, auth, wallet))
.map_err(|e| ExitError::new(ExitCode::GrpcError, e))?;
}
#[cfg(not(feature = "grpc"))]
return Err(ExitError::new(
ExitCode::GrpcError,
"gRPC server is enabled but not supported in this build",
));
} else {
println!("GRPC server is disabled");
}
Expand Down
2 changes: 1 addition & 1 deletion comms/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ rand = "0.8"
serde = "1.0.119"
serde_derive = "1.0.119"
sha3 = "0.10"
snow = { version = "=0.9.3", features = ["default-resolver"] }
snow = { version = "0.9.4", features = ["default-resolver"] }
thiserror = "1.0.26"
tokio = { version = "1.23", features = ["rt-multi-thread", "time", "sync", "signal", "net", "macros", "io-util"] }
tokio-stream = { version = "0.1.9", features = ["sync"] }
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tari_common = { path = "../common" }
tari_common_types = { path = "../base_layer/common_types" }
tari_comms = { path = "../comms/core" }
tari_comms_dht = { path = "../comms/dht" }
minotari_console_wallet = { path = "../applications/minotari_console_wallet" }
minotari_console_wallet = { path = "../applications/minotari_console_wallet", features = ["grpc"] }
tari_contacts = { path = "../base_layer/contacts" }
tari_core = { path = "../base_layer/core" }
minotari_merge_mining_proxy = { path = "../applications/minotari_merge_mining_proxy" }
Expand Down

0 comments on commit b931592

Please sign in to comment.