Immediately fetch transaction status upon subscription

Immediately fetch transaction status upon subscription instead of waiting 1 minute
This commit is contained in:
binarybaron 2022-10-28 16:31:07 +02:00
parent 1fdead9e0a
commit 5662f7fe81

View File

@ -143,8 +143,6 @@ impl Wallet {
let mut last_status = None;
loop {
tokio::time::sleep(Duration::from_secs(5)).await;
let new_status = match client.lock().await.status_of_script(&tx) {
Ok(new_status) => new_status,
Err(error) => {
@ -165,6 +163,8 @@ impl Wallet {
return;
}
}
tokio::time::sleep(Duration::from_secs(5)).await;
}
});
@ -696,7 +696,7 @@ impl Client {
Ok(Self {
electrum,
latest_block_height: BlockHeight::try_from(latest_block)?,
last_sync: Instant::now(),
last_sync: Instant::now() - interval,
sync_interval: interval,
script_history: Default::default(),
subscriptions: Default::default(),