diff --git a/mm2src/mm2_main/src/lp_swap/taker_swap.rs b/mm2src/mm2_main/src/lp_swap/taker_swap.rs index 1b72199244..f5f8868a62 100644 --- a/mm2src/mm2_main/src/lp_swap/taker_swap.rs +++ b/mm2src/mm2_main/src/lp_swap/taker_swap.rs @@ -1824,6 +1824,28 @@ impl TakerSwap { let tx_hash = transaction.tx_hash_as_bytes(); info!("Maker payment spend tx {:02x}", tx_hash); + + // we should wait for only one confirmation to make sure spend maker payment transaction is not failed + let confirmations = std::cmp::min(1, self.r().data.maker_payment_confirmations); + let confirm_maker_payment_spend_input = ConfirmPaymentInput { + payment_tx: transaction.tx_hex(), + confirmations, + requires_nota: false, + wait_until: self.wait_refund_until(), + check_every: WAIT_CONFIRM_INTERVAL_SEC, + }; + let wait_fut = self + .maker_coin + .wait_for_confirmations(confirm_maker_payment_spend_input); + if let Err(err) = wait_fut.compat().await { + return Ok((Some(TakerSwapCommand::Finish), vec![ + TakerSwapEvent::MakerPaymentSpendFailed( + ERRL!("!wait for maker payment spend confirmations: {}", err).into(), + ), + ])); + } + info!("Maker payment spend confirmed"); + let tx_ident = TransactionIdentifier { tx_hex: BytesJson::from(transaction.tx_hex()), tx_hash,