Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
update sync status after trial decrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapk00 committed Aug 10, 2021
1 parent b9075f8 commit 4e355ae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/src/blaze/trial_decryptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ impl TrialDecryptions {
.collect::<Vec<_>>(),
);

let sync_status = bsync_data.read().await.sync_status.clone();

while let Some(cb) = rx.recv().await {
cbs.push(cb);

Expand All @@ -70,7 +68,6 @@ impl TrialDecryptions {
let bsync_data = bsync_data.clone();
let detected_txid_sender = detected_txid_sender.clone();

sync_status.write().await.trial_dec_done += cbs.len() as u64;
workers.push(tokio::spawn(Self::trial_decrypt_batch(
cbs.split_off(0),
keys,
Expand All @@ -82,7 +79,6 @@ impl TrialDecryptions {
}
}

sync_status.write().await.trial_dec_done += cbs.len() as u64;
workers.push(tokio::spawn(Self::trial_decrypt_batch(
cbs,
keys,
Expand Down Expand Up @@ -111,6 +107,8 @@ impl TrialDecryptions {
detected_txid_sender: UnboundedSender<(TxId, Nullifier, BlockHeight, Option<u32>)>,
) -> Result<(), String> {
let config = keys.read().await.config().clone();
let blk_count = cbs.len();

for cb in cbs {
let height = BlockHeight::from_u32(cb.height as u32);

Expand Down Expand Up @@ -173,6 +171,9 @@ impl TrialDecryptions {
}
}

// Update sync status
bsync_data.read().await.sync_status.write().await.trial_dec_done += blk_count as u64;

// Return a nothing-value
Ok::<(), String>(())
}
Expand Down

0 comments on commit 4e355ae

Please sign in to comment.