finish cooperative psbt assembly with pseudo escrow output

This commit is contained in:
fbock
2024-08-08 10:19:11 +02:00
parent 201706d555
commit 3264cf44c3
4 changed files with 7 additions and 10 deletions

View File

@ -209,16 +209,12 @@ pub async fn fetch_escrow_confirmation_status(
Err(e) => return Err(FetchEscrowConfirmationError::Database(e.to_string())),
}
if match database
match database
.fetch_escrow_tx_confirmation_status(&payload.offer_id_hex)
.await
{
Ok(status) => status,
Ok(status) => Ok(status),
Err(e) => return Err(FetchEscrowConfirmationError::Database(e.to_string())),
} {
Ok(true)
} else {
Err(FetchEscrowConfirmationError::NotFound)
}
}

View File

@ -816,7 +816,8 @@ impl CoordinatorDB {
let is_buy_order: bool = 1 == row.get::<i64, _>("is_buy_order");
let bond_amount_sat: u64 = row.get("bond_amount_sat");
let escrow_fee_per_participant: u64 = (amount_sat as f64 * coordinator_feerate) as u64;
let escrow_fee_per_participant: u64 =
(amount_sat as f64 * (coordinator_feerate / 100.0)) as u64;
let (escrow_amount_maker_sat, escrow_amount_taker_sat) = if is_buy_order {
(amount_sat + bond_amount_sat, bond_amount_sat)

View File

@ -233,7 +233,7 @@ impl IsOfferReadyRequest {
.send()?;
if res.status() == 200 {
return Ok(());
} else if res.status() != 204 {
} else if res.status() != 202 {
return Err(anyhow!(
"Requesting offer status when waiting on other party failed: {}",
res.status()

View File

@ -180,9 +180,9 @@ impl TradingWallet {
// }
pub fn sign_escrow_psbt(&self, escrow_psbt: &mut PartiallySignedTransaction) -> Result<&Self> {
// do not finalize as the psbt will be finalized by the coordinator
// we need to finalize here too to make finalizing on the coordinator side work
let sign_options = SignOptions {
try_finalize: false,
try_finalize: true,
..SignOptions::default()
};
let _ = self.wallet.sign(escrow_psbt, sign_options)?;