diff --git a/taptrade-cli-demo/coordinator/src/communication/mod.rs b/taptrade-cli-demo/coordinator/src/communication/mod.rs index 0bac4d0..b2c7493 100755 --- a/taptrade-cli-demo/coordinator/src/communication/mod.rs +++ b/taptrade-cli-demo/coordinator/src/communication/mod.rs @@ -127,7 +127,10 @@ async fn submit_escrow_psbt( Err(RequestError::PsbtAlreadySubmitted) => { Ok(StatusCode::INTERNAL_SERVER_ERROR.into_response()) } - Err(RequestError::PsbtInvalid) => Ok(StatusCode::NOT_ACCEPTABLE.into_response()), + Err(RequestError::PsbtInvalid(e)) => { + warn!("Invalid PSBT: {e}"); + Ok(StatusCode::NOT_ACCEPTABLE.into_response()) + } _ => Ok(StatusCode::INTERNAL_SERVER_ERROR.into_response()), // Err(RequestError::NotFound) => { // info!("Offer for escrow psbt not found"); @@ -187,6 +190,10 @@ async fn submit_obligation_confirmation( error!("Database error fetching obligation confirmation: {e}"); Ok(StatusCode::INTERNAL_SERVER_ERROR.into_response()) } + _ => { + error!("Unknown error handling obligation confirmation"); + Ok(StatusCode::INTERNAL_SERVER_ERROR.into_response()) + } } } @@ -212,6 +219,10 @@ async fn request_escrow( error!("Database error fetching obligation confirmation: {e}"); Ok(StatusCode::INTERNAL_SERVER_ERROR.into_response()) } + _ => { + error!("Unknown error handling request_escrow()"); + Ok(StatusCode::INTERNAL_SERVER_ERROR.into_response()) + } } } @@ -240,6 +251,10 @@ async fn poll_final_payout( error!("Database error fetching final payout: {e}"); Ok(StatusCode::INTERNAL_SERVER_ERROR.into_response()) } + _ => { + error!("Unknown error handling poll_final_payout()"); + Ok(StatusCode::INTERNAL_SERVER_ERROR.into_response()) + } } } diff --git a/taptrade-cli-demo/coordinator/src/wallet/escrow_psbt.rs b/taptrade-cli-demo/coordinator/src/wallet/escrow_psbt.rs index 41acc52..9b1e7e5 100644 --- a/taptrade-cli-demo/coordinator/src/wallet/escrow_psbt.rs +++ b/taptrade-cli-demo/coordinator/src/wallet/escrow_psbt.rs @@ -1,11 +1,10 @@ use super::*; use bdk::{ - bitcoin::psbt::Input, + bitcoin::psbt::PartiallySignedTransaction, descriptor::Descriptor, miniscript::{descriptor::TapTree, policy::Concrete, Tap}, SignOptions, }; -use bitcoin::psbt::PartiallySignedTransaction; use musig2::{secp256k1::PublicKey as MuSig2PubKey, KeyAggContext}; #[derive(Debug)] @@ -237,13 +236,12 @@ impl CoordinatorWallet { let mut maker_psbt = PartiallySignedTransaction::from_str(signed_maker_psbt_hex)?; let taker_psbt = PartiallySignedTransaction::from_str(signed_taker_psbt_hex)?; - maker_psbt.combine(&taker_psbt)?; + maker_psbt.combine(taker_psbt)?; let wallet = self.wallet.lock().await; match wallet.finalize_psbt(&mut maker_psbt, SignOptions::default()) { Ok(true) => { let tx = maker_psbt.extract_tx(); - let tx_hex = tx.to_string(); self.backend.broadcast(&tx)?; info!("Escrow transaction broadcasted: {}", tx.txid()); Ok(())