From 292b7135ab93c19e5cc4b048afe46abef52b5320 Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Fri, 3 Jan 2025 12:38:13 +0100 Subject: [PATCH] [bug] deadlock in commit --- src/commit.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commit.rs b/src/commit.rs index ef6a4f7..7ed0278 100644 --- a/src/commit.rs +++ b/src/commit.rs @@ -13,7 +13,7 @@ use sdk_common::sp_client::bitcoin::{Amount, Transaction, OutPoint}; use sdk_common::process::{Process, ProcessState, CACHEDPROCESSES}; use serde_json::json; -use crate::{lock_freezed_utxos, MutexExt, DAEMON, WALLET}; +use crate::{lock_freezed_utxos, MutexExt, DAEMON, LISTS, WALLET}; pub(crate) fn handle_commit_request(commit_msg: CommitMessage) -> Result { // Attempt to process the initial transaction or reference @@ -193,7 +193,7 @@ fn commit_new_transaction( .checked_div(1000) .unwrap(); - let freezed_utxos = lock_freezed_utxos()?; + let mut freezed_utxos = lock_freezed_utxos()?; let psbt = create_transaction( vec![mandatory_input], @@ -211,7 +211,7 @@ fn commit_new_transaction( let txid = daemon.broadcast(&new_tx)?; let commited_in = OutPoint::new(txid, 0); - lock_freezed_utxos()?.insert(commited_in); + freezed_utxos.insert(commited_in); commitment.update_states_tip(commited_in)?; Ok(commited_in)