fix command
This commit is contained in:
@@ -668,7 +668,7 @@ impl Command for ImportCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let key = args[0];
|
let key = args[0];
|
||||||
|
|
||||||
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),
|
||||||
@@ -701,7 +701,7 @@ impl Command for TImportCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let key = args[0];
|
let key = args[0];
|
||||||
|
|
||||||
let r = match lightclient.do_import_tk(key.to_string(), 0) {
|
let r = match lightclient.do_import_tk(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),
|
||||||
|
|||||||
@@ -1018,7 +1018,7 @@ impl LightClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let new_address = {
|
let new_address = {
|
||||||
let wallet = self.wallet.write().unwrap();
|
let mut wallet = self.wallet.write().unwrap();
|
||||||
|
|
||||||
let addr = wallet.import_taddr(sk, birthday);
|
let addr = wallet.import_taddr(sk, birthday);
|
||||||
if addr.starts_with("Error") {
|
if addr.starts_with("Error") {
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ impl LightWallet {
|
|||||||
address
|
address
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn import_taddr(&self, sk: String, birthday: u64) -> String {
|
pub fn import_taddr(&mut self, sk: String, birthday: u64) -> String {
|
||||||
if !self.unlocked {
|
if !self.unlocked {
|
||||||
return "Error: Can't add key while wallet is locked".to_string();
|
return "Error: Can't add key while wallet is locked".to_string();
|
||||||
}
|
}
|
||||||
@@ -657,6 +657,11 @@ impl LightWallet {
|
|||||||
//// Add to tkeys
|
//// Add to tkeys
|
||||||
self.tkeys.write().unwrap().push(WalletTKey::import_hdkey(sk_raw , address.clone()));
|
self.tkeys.write().unwrap().push(WalletTKey::import_hdkey(sk_raw , address.clone()));
|
||||||
|
|
||||||
|
// Adjust wallet birthday
|
||||||
|
if birthday < self.birthday {
|
||||||
|
self.birthday = if birthday < self.config.sapling_activation_height {self.config.sapling_activation_height} else {birthday};
|
||||||
|
}
|
||||||
|
|
||||||
address
|
address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user