This commit is contained in:
pokkst 2025-08-19 16:50:37 +08:00 committed by GitHub
commit 06d34b7fff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 1 deletions

View file

@ -36,6 +36,7 @@ pub trait MoneroWalletRpc {
async fn refresh(&self) -> Refreshed; async fn refresh(&self) -> Refreshed;
async fn sweep_all(&self, address: String) -> SweepAll; async fn sweep_all(&self, address: String) -> SweepAll;
async fn get_version(&self) -> Version; async fn get_version(&self) -> Version;
async fn store(&self);
} }
#[jsonrpc_client::implement(MoneroWalletRpc)] #[jsonrpc_client::implement(MoneroWalletRpc)]

View file

@ -466,7 +466,8 @@ async fn init_monero_wallet(
env_config, env_config,
) )
.await?; .await?;
let _ = wallet.refresh().await?;
wallet.store().await?;
Ok(wallet) Ok(wallet)
} }

View file

@ -71,6 +71,11 @@ impl Wallet {
Ok(()) Ok(())
} }
pub async fn store(&self) -> Result<()> {
self.inner.lock().await.store().await?;
Ok(())
}
/// Close the wallet and open (load) another wallet by generating it from /// Close the wallet and open (load) another wallet by generating it from
/// keys. The generated wallet will remain loaded. /// keys. The generated wallet will remain loaded.
pub async fn create_from_and_load( pub async fn create_from_and_load(

View file

@ -189,6 +189,8 @@ where
) )
})?; })?;
monero_wallet.store().await?;
AliceState::XmrLocked { AliceState::XmrLocked {
monero_wallet_restore_blockheight, monero_wallet_restore_blockheight,
transfer_proof, transfer_proof,
@ -395,6 +397,8 @@ where
) )
.await?; .await?;
monero_wallet.store().await?;
AliceState::XmrRefunded AliceState::XmrRefunded
} }
AliceState::BtcPunishable { AliceState::BtcPunishable {