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:
Thomas Eizinger 2021-03-05 16:24:02 +11:00
parent 13c4d29d40
commit c2329b19a2
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
3 changed files with 16 additions and 3 deletions

View File

@ -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)]
#[error("transaction does not pay enough: expected {expected}, got {actual}")]
pub struct InsufficientFunds {

View File

@ -160,7 +160,7 @@ impl Wallet {
expected_amount: Amount,
conf_target: u32,
) -> 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 { "" });

View File

@ -133,16 +133,23 @@ async fn run_until_internal(
// block 0 once we create the redeem wallet.
let monero_wallet_restore_blockheight = monero_wallet.block_height().await?;
tracing::info!("Waiting for Alice to lock Monero");
select! {
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 {
state: state3,
lock_transfer_proof: transfer_proof.tx_lock_proof,
lock_transfer_proof: transfer_proof,
monero_wallet_restore_blockheight
}
},
_ = cancel_timelock_expires => {
tracing::info!("Alice took too long to lock Monero, cancelling the swap");
let state4 = state3.cancel();
BobState::CancelTimelockExpired(state4)
}