|
@ -674,29 +674,11 @@ impl Command for ImportCommand { |
|
|
|
|
|
|
|
|
let key = args[0]; |
|
|
let key = args[0]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let rescan = if args.len() == 3 { |
|
|
|
|
|
if args[2] == "norescan" || args[2] == "false" || args[2] == "no" {
|
|
|
|
|
|
false
|
|
|
|
|
|
} else { |
|
|
|
|
|
return format!("Couldn't undestand the argument '{}'. Please pass 'norescan' to prevent rescanning the wallet", args[2]); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
true |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
let r = match lightclient.do_import_key(key.to_string(), 0) { |
|
|
let r = match lightclient.do_import_key(key.to_string(), 0) { |
|
|
Ok(r) => r.pretty(2), |
|
|
Ok(r) => r.pretty(2), |
|
|
Err(e) => return format!("Error: {}", e), |
|
|
Err(e) => return format!("Error: {}", e), |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
if rescan { |
|
|
|
|
|
match lightclient.do_rescan() { |
|
|
|
|
|
Ok(_) => {}, |
|
|
|
|
|
Err(e) => return format!("Error: Rescan failed: {}", e), |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return r; |
|
|
return r; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -727,12 +709,6 @@ impl Command for TImportCommand { |
|
|
Err(e) => return format!("Error: {}", e), |
|
|
Err(e) => return format!("Error: {}", e), |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
match lightclient.do_rescan() { |
|
|
|
|
|
Ok(_) => {}, |
|
|
|
|
|
Err(e) => return format!("Error: Rescan failed: {}", e), |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return r; |
|
|
return r; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|