mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Tell the user more about the monero lock transaction
First, we tell the user that we are now waiting for Alice to lock the monero. Additionally, we tell them once we received the transfer proof which will lead directly into the "waiting for confirmations" function.
This commit is contained in:
parent
13c4d29d40
commit
c2329b19a2
@ -175,6 +175,12 @@ impl From<TxHash> for String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for TxHash {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "{}", self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, thiserror::Error)]
|
#[derive(Debug, Clone, Copy, thiserror::Error)]
|
||||||
#[error("transaction does not pay enough: expected {expected}, got {actual}")]
|
#[error("transaction does not pay enough: expected {expected}, got {actual}")]
|
||||||
pub struct InsufficientFunds {
|
pub struct InsufficientFunds {
|
||||||
|
@ -160,7 +160,7 @@ impl Wallet {
|
|||||||
expected_amount: Amount,
|
expected_amount: Amount,
|
||||||
conf_target: u32,
|
conf_target: u32,
|
||||||
) -> Result<(), InsufficientFunds> {
|
) -> Result<(), InsufficientFunds> {
|
||||||
let txid = &transfer_proof.tx_hash.0;
|
let txid = &transfer_proof.tx_hash();
|
||||||
|
|
||||||
tracing::info!(%txid, "Waiting for {} confirmation{} of Monero transaction", conf_target, if conf_target > 1 { "s" } else { "" });
|
tracing::info!(%txid, "Waiting for {} confirmation{} of Monero transaction", conf_target, if conf_target > 1 { "s" } else { "" });
|
||||||
|
|
||||||
|
@ -133,16 +133,23 @@ async fn run_until_internal(
|
|||||||
// block 0 once we create the redeem wallet.
|
// block 0 once we create the redeem wallet.
|
||||||
let monero_wallet_restore_blockheight = monero_wallet.block_height().await?;
|
let monero_wallet_restore_blockheight = monero_wallet.block_height().await?;
|
||||||
|
|
||||||
|
tracing::info!("Waiting for Alice to lock Monero");
|
||||||
|
|
||||||
select! {
|
select! {
|
||||||
transfer_proof = transfer_proof_watcher => {
|
transfer_proof = transfer_proof_watcher => {
|
||||||
let transfer_proof = transfer_proof?;
|
let transfer_proof = transfer_proof?.tx_lock_proof;
|
||||||
|
|
||||||
|
tracing::info!(txid = %transfer_proof.tx_hash(), "Alice locked Monero");
|
||||||
|
|
||||||
BobState::XmrLockProofReceived {
|
BobState::XmrLockProofReceived {
|
||||||
state: state3,
|
state: state3,
|
||||||
lock_transfer_proof: transfer_proof.tx_lock_proof,
|
lock_transfer_proof: transfer_proof,
|
||||||
monero_wallet_restore_blockheight
|
monero_wallet_restore_blockheight
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ = cancel_timelock_expires => {
|
_ = cancel_timelock_expires => {
|
||||||
|
tracing::info!("Alice took too long to lock Monero, cancelling the swap");
|
||||||
|
|
||||||
let state4 = state3.cancel();
|
let state4 = state3.cancel();
|
||||||
BobState::CancelTimelockExpired(state4)
|
BobState::CancelTimelockExpired(state4)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user