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:
Thomas Eizinger 2021-03-29 12:07:09 +11:00
parent 36b92c9f1f
commit 1b63d5486d
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

View File

@ -288,6 +288,8 @@ where
let mut seen_confirmations = 0u32;
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 {
Ok(proof) => proof,
Err(error) => {
@ -312,8 +314,6 @@ where
seen_confirmations = tx.confirmations;
info!(%txid, "Monero lock tx has {} out of {} confirmations", tx.confirmations, conf_target);
}
check_interval.tick().await;
}
Ok(())