mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 07:11:36 +02:00
Added an extra warning message when failing to reach the node, work in progress on changing default dir for node api ssecret 'foreign_api_secret'
This commit is contained in:
+23
-2
@@ -83,6 +83,22 @@ fn check_config_current_dir(path: &str) -> Option<PathBuf> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Checks if the node api secret in wallet dir, else return default path
|
||||||
|
fn check_node_api_exists(path: &str) -> Option<PathBuf> {
|
||||||
|
let p = env::current_dir();
|
||||||
|
let mut c = match p {
|
||||||
|
Ok(c) => c,
|
||||||
|
Err(_) => {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
c.push(path);
|
||||||
|
if c.exists() {
|
||||||
|
return Some(c);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether a config file exists at the given directory
|
/// Whether a config file exists at the given directory
|
||||||
pub fn config_file_exists(path: &str) -> bool {
|
pub fn config_file_exists(path: &str) -> bool {
|
||||||
let mut path = PathBuf::from(path);
|
let mut path = PathBuf::from(path);
|
||||||
@@ -279,8 +295,13 @@ impl GlobalWalletConfig {
|
|||||||
Some(secret_path.to_str().unwrap().to_owned());
|
Some(secret_path.to_str().unwrap().to_owned());
|
||||||
let mut node_secret_path = wallet_home.clone();
|
let mut node_secret_path = wallet_home.clone();
|
||||||
node_secret_path.push(API_SECRET_FILE_NAME);
|
node_secret_path.push(API_SECRET_FILE_NAME);
|
||||||
self.members.as_mut().unwrap().wallet.node_api_secret_path =
|
// Set node API secret path to the wallet dir if it exists, else keep default home dir
|
||||||
Some(node_secret_path.to_str().unwrap().to_owned());
|
// if node_secret_path.exists(){
|
||||||
|
// self.members.as_mut().unwrap().wallet.node_api_secret_path =
|
||||||
|
// Some(node_secret_path.to_str().unwrap().to_owned());
|
||||||
|
// println!("It node path does actually exists")
|
||||||
|
// }
|
||||||
|
|
||||||
let mut log_path = wallet_home.clone();
|
let mut log_path = wallet_home.clone();
|
||||||
log_path.push(WALLET_LOG_FILE_NAME);
|
log_path.push(WALLET_LOG_FILE_NAME);
|
||||||
self.members
|
self.members
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ impl NodeClient for HTTPNodeClient {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
error!("Unable to contact Node to get version info: {}", e);
|
error!("Unable to contact Node to get version info: {}", e);
|
||||||
|
warn!("Warning: You might need to correct 'node_api_secret_path' in your 'grin-wallet.toml' file");
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user