Browse Source

fix deadlock while adding new addresses

checkpoints
Aditya Kulkarni 5 years ago
parent
commit
a0da414bca
  1. 20
      lib/src/lightclient.rs

20
lib/src/lightclient.rs

@ -827,15 +827,17 @@ impl LightClient {
return Err("Wallet is locked".to_string());
}
let wallet = self.wallet.write().unwrap();
let new_address = match addr_type {
"z" => wallet.add_zaddr(),
"t" => wallet.add_taddr(),
_ => {
let e = format!("Unrecognized address type: {}", addr_type);
error!("{}", e);
return Err(e);
let new_address = {
let wallet = self.wallet.write().unwrap();
match addr_type {
"z" => wallet.add_zaddr(),
"t" => wallet.add_taddr(),
_ => {
let e = format!("Unrecognized address type: {}", addr_type);
error!("{}", e);
return Err(e);
}
}
};

Loading…
Cancel
Save