Browse Source

Merge pull request #41 from DenioD/dev

dev to master
checkpoints
Denio 5 years ago
committed by GitHub
parent
commit
98c284020f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cli/src/lib.rs
  2. 15
      lib/src/lightclient.rs
  3. 20
      lib/src/lightwallet/startup_helpers.rs
  4. 20
      lib/src/startup_helpers.rs

6
cli/src/lib.rs

@ -75,11 +75,11 @@ pub fn report_permission_error() {
eprintln!("HOME: {}", home);
eprintln!("Executable: {}", current_executable.display());
if home == "/" {
eprintln!("User {} must have permission to write to '{}silentdragonlite/' .",
eprintln!("User {} must have permission to write to '{}.silentdragonlite/' .",
user,
home);
} else {
eprintln!("User {} must have permission to write to '{}/silentdragonlite/' .",
eprintln!("User {} must have permission to write to '{}/.silentdragonlite/' .",
user,
home);
}
@ -89,7 +89,7 @@ pub fn report_permission_error() {
pub fn get_log_config(config: &LightClientConfig) -> io::Result<Config> {
let window_size = 3; // log0, log1, log2
let fixed_window_roller =
FixedWindowRoller::builder().build("Silentdragonlite-light-wallet-log{}",window_size).unwrap();
FixedWindowRoller::builder().build("Silentdragonlite-wallet-log{}",window_size).unwrap();
let size_limit = 5 * 1024 * 1024; // 5MB as max log file size to roll
let size_trigger = SizeTrigger::new(size_limit);
let compound_policy = CompoundPolicy::new(Box::new(size_trigger),Box::new(fixed_window_roller));

15
lib/src/lightclient.rs

@ -27,7 +27,7 @@ use crate::ANCHOR_OFFSET;
mod checkpoints;
pub const DEFAULT_SERVER: &str = "https://";
pub const DEFAULT_SERVER: &str = "https://hush-lightwallet.de:443";
pub const WALLET_NAME: &str = "silentdragonlite-wallet.dat";
pub const LOGFILE_NAME: &str = "silentdragonlite-wallet.debug.log";
@ -110,7 +110,7 @@ impl LightClientConfig {
zcash_data_location.push("silentdragonlite");
} else {
zcash_data_location = dirs::home_dir().expect("Couldn't determine home directory!");
zcash_data_location.push("silentdragonlite/");
zcash_data_location.push(".silentdragonlite");
};
match &self.chain_name[..] {
@ -120,8 +120,15 @@ impl LightClientConfig {
c => panic!("Unknown chain {}", c),
};
}
zcash_data_location.into_boxed_path()
// Create directory if it doesn't exist
match std::fs::create_dir_all(zcash_data_location.clone()) {
Ok(_) => zcash_data_location.into_boxed_path(),
Err(e) => {
eprintln!("Couldn't create zcash directory!\n{}", e);
panic!("Couldn't create zcash directory!");
}
}
}
pub fn get_wallet_path(&self) -> Box<Path> {

20
lib/src/lightwallet/startup_helpers.rs

@ -1,20 +0,0 @@
pub fn report_permission_error() {
let user = std::env::var("USER").expect(
"Unexpected error reading value of $USER!");
let home = std::env::var("HOME").expect(
"Unexpected error reading value of $HOME!");
let current_executable = std::env::current_exe()
.expect("Unexpected error reporting executable path!");
eprintln!("USER: {}", user);
eprintln!("HOME: {}", home);
eprintln!("Executable: {}", current_executable.display());
if home == "/" {
eprintln!("User {} must have permission to write to '{}silentdragonlite/' .",
user,
home);
} else {
eprintln!("User {} must have permission to write to '{}/silentdragonlite/ .",
user,
home);
}
}

20
lib/src/startup_helpers.rs

@ -1,20 +0,0 @@
pub fn report_permission_error() {
let user = std::env::var("USER").expect(
"Unexpected error reading value of $USER!");
let home = std::env::var("HOME").expect(
"Unexpected error reading value of $HOME!");
let current_executable = std::env::current_exe()
.expect("Unexpected error reporting executable path!");
eprintln!("USER: {}", user);
eprintln!("HOME: {}", home);
eprintln!("Executable: {}", current_executable.display());
if home == "/" {
eprintln!("User {} must have permission to write to '{}silentdragonlite/' .",
user,
home);
} else {
eprintln!("User {} must have permission to write to '{}/silentdragonlite/ .",
user,
home);
}
}
Loading…
Cancel
Save