From ba318b9bd3f83436e55b3c1dad03e47a9b1fc1c8 Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Tue, 28 Jan 2025 21:41:45 +0100 Subject: [PATCH] [bug] deadlock when spending from core for the faucet --- src/faucet.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/faucet.rs b/src/faucet.rs index 42aa096..ddafc6a 100644 --- a/src/faucet.rs +++ b/src/faucet.rs @@ -235,13 +235,15 @@ fn faucet_send(sp_address: SilentPaymentAddress, commitment: &str) -> Result<(Tr faucet_tx.input[0].witness.push(final_sig.to_vec()); - let daemon = DAEMON - .get() - .ok_or(Error::msg("DAEMON not initialized"))? - .lock_anyhow()?; - daemon.broadcast(&core_tx)?; - let txid = daemon.broadcast(&faucet_tx)?; - log::debug!("Sent tx {}", txid); + { + let daemon = DAEMON + .get() + .ok_or(Error::msg("DAEMON not initialized"))? + .lock_anyhow()?; + daemon.broadcast(&core_tx)?; + let txid = daemon.broadcast(&faucet_tx)?; + log::debug!("Sent tx {}", txid); + } let partial_tweak = compute_partial_tweak_to_transaction(&faucet_tx)?;