From 1b63d5486df8f33b3d7950685fcbbb1ac8b056a9 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 29 Mar 2021 12:07:09 +1100 Subject: [PATCH] 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. --- swap/src/monero/wallet.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs index 4c643356..d5076296 100644 --- a/swap/src/monero/wallet.rs +++ b/swap/src/monero/wallet.rs @@ -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(())