mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-28 17:09:37 -05:00
Tell the user immediately how many confirmations we expect
Without this, the user doesn't see a message before the first confirmation.
This commit is contained in:
parent
4883e23dd8
commit
13c4d29d40
@ -158,8 +158,12 @@ impl Wallet {
|
||||
public_view_key: PublicViewKey,
|
||||
transfer_proof: TransferProof,
|
||||
expected_amount: Amount,
|
||||
expected_confirmations: u32,
|
||||
conf_target: u32,
|
||||
) -> Result<(), InsufficientFunds> {
|
||||
let txid = &transfer_proof.tx_hash.0;
|
||||
|
||||
tracing::info!(%txid, "Waiting for {} confirmation{} of Monero transaction", conf_target, if conf_target > 1 { "s" } else { "" });
|
||||
|
||||
enum Error {
|
||||
TxNotFound,
|
||||
InsufficientConfirmations,
|
||||
@ -196,11 +200,10 @@ impl Wallet {
|
||||
if proof.confirmations >= confirmations.load(Ordering::SeqCst) {
|
||||
confirmations.store(proof.confirmations, Ordering::SeqCst);
|
||||
|
||||
let txid = &transfer_proof.tx_hash.0;
|
||||
info!(%txid, "Monero lock tx has {} out of {} confirmations", proof.confirmations, expected_confirmations);
|
||||
info!(%txid, "Monero lock tx has {} out of {} confirmations", proof.confirmations, conf_target);
|
||||
}
|
||||
|
||||
if proof.confirmations < expected_confirmations {
|
||||
if proof.confirmations < conf_target {
|
||||
return Err(backoff::Error::Transient(Error::InsufficientConfirmations));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user