Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 23ae28b

Browse files
committed
Rely on utils
1 parent 20c224b commit 23ae28b

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

mutiny-core/src/nodemanager.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ impl<S: MutinyStorage> NodeManager<S> {
10771077
log_debug!(self.logger, "{pj_uri}");
10781078
let wallet = self.wallet.clone();
10791079
// run await payjoin task in the background as it'll keep polling the relay
1080-
wasm_bindgen_futures::spawn_local(async move {
1080+
utils::spawn(async move {
10811081
let wallet = wallet.clone();
10821082
let pj_txid = Self::receive_payjoin(wallet, enrolled).await.unwrap();
10831083
log::info!("Received payjoin txid: {}", pj_txid);
@@ -1214,22 +1214,11 @@ impl<S: MutinyStorage> NodeManager<S> {
12141214
.unwrap();
12151215
match proposal {
12161216
Some(proposal) => return Ok(proposal),
1217-
None => Self::delay(5000).await.unwrap(),
1217+
None => utils::sleep(5000).await,
12181218
}
12191219
}
12201220
}
12211221

1222-
async fn delay(millis: u32) -> Result<(), wasm_bindgen::JsValue> {
1223-
let promise = js_sys::Promise::new(&mut |yes, _| {
1224-
let win = web_sys::window().expect("should have a Window");
1225-
win.set_timeout_with_callback_and_timeout_and_arguments_0(&yes, millis as i32)
1226-
.expect("should set a timeout");
1227-
});
1228-
1229-
wasm_bindgen_futures::JsFuture::from(promise).await?;
1230-
Ok(())
1231-
}
1232-
12331222
/// Sends an on-chain transaction to the given address.
12341223
/// The amount is in satoshis and the fee rate is in sat/vbyte.
12351224
///

0 commit comments

Comments
 (0)