From f7703e103fd26ed3d54fbb25fd98fd059899c490 Mon Sep 17 00:00:00 2001 From: yse <70684173+hydra-yse@users.noreply.github.com> Date: Thu, 28 Mar 2024 09:18:41 +0100 Subject: [PATCH] fix: switch to single-threaded claiming (#63) --- lib/src/wallet.rs | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/lib/src/wallet.rs b/lib/src/wallet.rs index d24854b58..c3b3b388e 100644 --- a/lib/src/wallet.rs +++ b/lib/src/wallet.rs @@ -101,25 +101,21 @@ impl Wallet { thread::sleep(Duration::from_secs(5)); let ongoing_swaps = cloned.swap_persister.list_ongoing_swaps().unwrap(); - thread::scope(|scope| { - for swap in ongoing_swaps { - scope.spawn(|| { - if let OngoingSwap::Receive { - id, - preimage, - redeem_script, - blinding_key, - .. - } = swap - { - match cloned.try_claim(&preimage, &redeem_script, &blinding_key, None) { - Ok(_) => cloned.swap_persister.resolve_ongoing_swap(&id).unwrap(), - Err(e) => warn!("Could not claim yet. Err: {e}"), - } - } - }); + for swap in ongoing_swaps { + if let OngoingSwap::Receive { + id, + preimage, + redeem_script, + blinding_key, + .. + } = swap + { + match cloned.try_claim(&preimage, &redeem_script, &blinding_key, None) { + Ok(_) => cloned.swap_persister.resolve_ongoing_swap(&id).unwrap(), + Err(e) => warn!("Could not claim yet. Err: {e}"), + } } - }); + } }); Ok(())