Skip to content

Commit

Permalink
chore: Also call request_stop_background_syncing when destroyed manually
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Jan 10, 2024
1 parent 0c3e0b6 commit df628ed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bindings/nodejs/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ pub async fn create_wallet(options: String) -> Result<External<WalletMethodHandl

#[napi(js_name = "destroyWallet")]
pub async fn destroy_wallet(wallet: External<WalletMethodHandler>) {
**wallet.as_ref().write().await = None;
let mut wallet = wallet.as_ref().write().await;
if let Some(wallet) = &**wallet {
wallet.request_stop_background_syncing();
}
**wallet = None;
}

#[napi(js_name = "callWalletMethod")]
Expand Down

0 comments on commit df628ed

Please sign in to comment.