ibid
This commit is contained in:
@@ -95,20 +95,21 @@ impl EsploraWallet {
|
||||
let now = std::time::UNIX_EPOCH.elapsed().unwrap().as_secs();
|
||||
let _ = update.graph_update.update_last_seen_unconfirmed(now);
|
||||
self.wallet.apply_update(update)?;
|
||||
if let Some(changeset) = self.wallet.take_staged() {
|
||||
self.db.write(&changeset)?;
|
||||
}
|
||||
println!();
|
||||
self.persist_local()?;
|
||||
println!("Sync complete for {}", self.name);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn persist_local(&mut self) -> Result<(), anyhow::Error> {
|
||||
Ok(if let Some(changeset) = self.wallet.take_staged() {
|
||||
self.db.write(&changeset)?;
|
||||
})
|
||||
}
|
||||
|
||||
/// Gets the next unused address from the wallet.
|
||||
pub(crate) fn next_unused_address(&mut self) -> Result<AddressInfo, anyhow::Error> {
|
||||
let address = self.wallet.next_unused_address(KeychainKind::External);
|
||||
if let Some(changeset) = self.wallet.take_staged() {
|
||||
self.db.write(&changeset)?;
|
||||
}
|
||||
self.persist_local()?;
|
||||
println!(
|
||||
"Generated address: https://mutinynet.com/address/{}",
|
||||
address
|
||||
|
||||
Reference in New Issue
Block a user