mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-11-17 15:26:14 +00: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,
|
public_view_key: PublicViewKey,
|
||||||
transfer_proof: TransferProof,
|
transfer_proof: TransferProof,
|
||||||
expected_amount: Amount,
|
expected_amount: Amount,
|
||||||
expected_confirmations: u32,
|
conf_target: u32,
|
||||||
) -> Result<(), InsufficientFunds> {
|
) -> 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 {
|
enum Error {
|
||||||
TxNotFound,
|
TxNotFound,
|
||||||
InsufficientConfirmations,
|
InsufficientConfirmations,
|
||||||
@ -196,11 +200,10 @@ impl Wallet {
|
|||||||
if proof.confirmations >= confirmations.load(Ordering::SeqCst) {
|
if proof.confirmations >= confirmations.load(Ordering::SeqCst) {
|
||||||
confirmations.store(proof.confirmations, 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, conf_target);
|
||||||
info!(%txid, "Monero lock tx has {} out of {} confirmations", proof.confirmations, expected_confirmations);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if proof.confirmations < expected_confirmations {
|
if proof.confirmations < conf_target {
|
||||||
return Err(backoff::Error::Transient(Error::InsufficientConfirmations));
|
return Err(backoff::Error::Transient(Error::InsufficientConfirmations));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user