mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-25 23:49:31 -05:00
Move tick to the beginning of the loop
This ensures that we always wait for the provided interval, even in the case of a `continue` which happens if there is an error within the RPC call.
This commit is contained in:
parent
36b92c9f1f
commit
1b63d5486d
@ -288,6 +288,8 @@ where
|
|||||||
let mut seen_confirmations = 0u32;
|
let mut seen_confirmations = 0u32;
|
||||||
|
|
||||||
while seen_confirmations < conf_target {
|
while seen_confirmations < conf_target {
|
||||||
|
check_interval.tick().await; // tick() at the beginning of the loop so every `continue` tick()s as well
|
||||||
|
|
||||||
let tx = match fetch_tx(txid.clone()).await {
|
let tx = match fetch_tx(txid.clone()).await {
|
||||||
Ok(proof) => proof,
|
Ok(proof) => proof,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
@ -312,8 +314,6 @@ where
|
|||||||
seen_confirmations = tx.confirmations;
|
seen_confirmations = tx.confirmations;
|
||||||
info!(%txid, "Monero lock tx has {} out of {} confirmations", tx.confirmations, conf_target);
|
info!(%txid, "Monero lock tx has {} out of {} confirmations", tx.confirmations, conf_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
check_interval.tick().await;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user