add dummy function for random generated Sietch addresses in SDL

This commit is contained in:
DenioD
2020-01-06 21:01:51 +01:00
parent f53f73a0c0
commit 1db9c3198b
2 changed files with 57 additions and 1 deletions

View File

@@ -37,7 +37,7 @@ use crate::ANCHOR_OFFSET;
mod checkpoints;
pub const DEFAULT_SERVER: &str = "https://hush-lightwallet.de:443";
pub const DEFAULT_SERVER: &str = "https://lite.myhush.org";
pub const WALLET_NAME: &str = "silentdragonlite-wallet.dat";
pub const LOGFILE_NAME: &str = "silentdragonlite-wallet.debug.log";
@@ -867,6 +867,31 @@ impl LightClient {
Ok(array![new_address])
}
pub fn do_new_sietchaddress(&self, addr_type: &str) -> Result<JsonValue, String> {
if !self.wallet.read().unwrap().is_unlocked_for_spending() {
error!("Wallet is locked");
return Err("Wallet is locked".to_string());
}
let new_address = {
let wallet = self.wallet.write().unwrap();
match addr_type {
"zs" => wallet.add_zaddr(),
_ => {
let e = format!("Unrecognized address type: {}", addr_type);
error!("{}", e);
return Err(e);
}
}
};
self.do_save()?;
Ok(array![new_address])
}
pub fn clear_state(&self) {
// First, clear the state from the wallet
self.wallet.read().unwrap().clear_blocks();