Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: disable console wallet grpc #5988

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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
Loading