upstream updates

This commit is contained in:
DenioD
2020-05-09 10:34:33 +02:00
parent d3a66550ed
commit 84b1b75f2c
11 changed files with 140 additions and 73 deletions

View File

@@ -11,7 +11,7 @@ use silentdragonlitelib::{commands,
#[macro_export]
macro_rules! configure_clapapp {
( $freshapp: expr ) => {
$freshapp.version("1.0.0")
$freshapp.version("1.3.2")
.arg(Arg::with_name("dangerous")
.long("dangerous")
.help("Disable server TLS certificate verification. Use this if you're running a local lightwalletd with a self-signed certificate. WARNING: This is dangerous, don't use it with a server that is not your own.")
@@ -25,6 +25,10 @@ macro_rules! configure_clapapp {
.long("recover")
.help("Attempt to recover the seed from the wallet")
.takes_value(false))
.arg(Arg::with_name("password")
.long("password")
.help("When recovering seed, specify a password for the encrypted wallet")
.takes_value(true))
.arg(Arg::with_name("seed")
.short("s")
.long("seed")
@@ -232,7 +236,7 @@ pub fn command_loop(lightclient: Arc<LightClient>) -> (Sender<(String, Vec<Strin
(command_tx, resp_rx)
}
pub fn attempt_recover_seed() {
pub fn attempt_recover_seed(password: Option<String>) {
// Create a Light Client Config in an attempt to recover the file.
let config = LightClientConfig {
server: "0.0.0.0:0".parse().unwrap(),
@@ -244,7 +248,7 @@ pub fn attempt_recover_seed() {
data_dir: None,
};
match LightClient::attempt_recover_seed(&config) {
match LightClient::attempt_recover_seed(&config, password) {
Ok(seed) => println!("Recovered seed: '{}'", seed),
Err(e) => eprintln!("Failed to recover seed. Error: {}", e)
};

View File

@@ -4,6 +4,7 @@ use silentdragonlite_cli::{configure_clapapp,
startup,
start_interactive,
attempt_recover_seed};
//version::VERSION
use log::error;
pub fn main() {
@@ -12,9 +13,10 @@ pub fn main() {
let fresh_app = App::new("SilentDragonLite CLI");
let configured_app = configure_clapapp!(fresh_app);
let matches = configured_app.get_matches();
if matches.is_present("recover") {
// Create a Light Client Config in an attempt to recover the file.
attempt_recover_seed();
attempt_recover_seed(matches.value_of("password").map(|s| s.to_string()));
return;
}
@@ -54,8 +56,9 @@ pub fn main() {
let (command_tx, resp_rx) = match startup(server, dangerous, seed, birthday, !nosync, command.is_none()) {
Ok(c) => c,
Err(e) => {
eprintln!("Error during startup: {}", e);
error!("Error during startup: {}", e);
let emsg = format!("Error during startup:{}\nIf you repeatedly run into this issue, you might have to restore your wallet from your seed phrase.", e);
eprintln!("{}", emsg);
error!("{}", emsg);
if cfg!(target_os = "unix" ) {
match e.raw_os_error() {
Some(13) => report_permission_error(),

1
cli/src/version.rs Normal file
View File

@@ -0,0 +1 @@
pub const VERSION:&str = "1.3.2";