diff --git a/applications/tari_app_utilities/src/utilities.rs b/applications/tari_app_utilities/src/utilities.rs index aa40ad157f..f2ab6a6a5c 100644 --- a/applications/tari_app_utilities/src/utilities.rs +++ b/applications/tari_app_utilities/src/utilities.rs @@ -52,15 +52,15 @@ pub const LOG_TARGET: &str = "tari::application"; pub enum ExitCodes { #[error("There is an error in the wallet configuration: {0}")] ConfigError(String), - #[error("The wallet exited because an unknown error occurred. Check the logs for details.")] + #[error("The application exited because an unknown error occurred. Check the logs for details.")] UnknownError, - #[error("The wallet exited because an interface error occurred. Check the logs for details.")] + #[error("The application exited because an interface error occurred. Check the logs for details.")] InterfaceError, - #[error("The wallet exited. {0}")] + #[error("The application exited. {0}")] WalletError(String), #[error("The wallet was not able to start the GRPC server. {0}")] GrpcError(String), - #[error("The wallet did not accept the command input: {0}")] + #[error("The application did not accept the command input: {0}")] InputError(String), #[error("Invalid command: {0}")] CommandError(String), @@ -74,8 +74,10 @@ pub enum ExitCodes { ConversionError(String), #[error("Your password was incorrect.")] IncorrectPassword, - #[error("Your wallet is encrypted but no password was provided.")] + #[error("Your application is encrypted but no password was provided.")] NoPassword, + #[error("Tor connection is offline")] + TorOffline, } impl ExitCodes { @@ -93,6 +95,7 @@ impl ExitCodes { Self::NetworkError(_) => 110, Self::ConversionError(_) => 111, Self::IncorrectPassword | Self::NoPassword => 112, + Self::TorOffline => 113, } } } diff --git a/applications/tari_base_node/src/main.rs b/applications/tari_base_node/src/main.rs index 5cc6b22f37..e02e1b524d 100644 --- a/applications/tari_base_node/src/main.rs +++ b/applications/tari_base_node/src/main.rs @@ -116,7 +116,7 @@ use tari_app_utilities::{ utilities::{setup_runtime, ExitCodes}, }; use tari_common::{configuration::bootstrap::ApplicationType, ConfigBootstrap, GlobalConfig}; -use tari_comms::peer_manager::PeerFeatures; +use tari_comms::{peer_manager::PeerFeatures, tor::HiddenServiceControllerError}; use tari_shutdown::{Shutdown, ShutdownSignal}; use tokio::{runtime, task, time}; use tonic::transport::Server; @@ -198,6 +198,23 @@ async fn run_node(node_config: Arc, bootstrap: ConfigBootstrap) -> .await .map_err(|err| { error!(target: LOG_TARGET, "{}", err); + for boxed_error in err.chain() { + if let Some(HiddenServiceControllerError::TorControlPortOffline) = + boxed_error.downcast_ref::() + { + println!("Unable to connect to the Tor control port."); + println!( + "Please check that you have the Tor proxy running and that access to the Tor control port is \ + turned on.", + ); + println!("If you are unsure of what to do, use the following command to start the Tor proxy:"); + println!( + "tor --allow-missing-torrc --ignore-missing-torrc --clientonly 1 --socksport 9050 --controlport \ + 127.0.0.1:9051 --log \"notice stdout\" --clientuseipv6 1", + ); + return ExitCodes::TorOffline; + } + } ExitCodes::UnknownError })?;