From 6b204d1ddb09bc6ece0a23cfd0f8009bb8b27099 Mon Sep 17 00:00:00 2001 From: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> Date: Thu, 30 Dec 2021 14:10:00 +0100 Subject: [PATCH] Don't skip unconfirmed messages (#847) * don't skip unconfirmed messages * update comments and only skip confirmed messages --- src/account/sync/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/account/sync/mod.rs b/src/account/sync/mod.rs index b8139c80b..df4e129ea 100644 --- a/src/account/sync/mod.rs +++ b/src/account/sync/mod.rs @@ -168,11 +168,11 @@ pub(crate) async fn sync_address( let message_id = *found_output.message_id(); // if we already have the message stored - // and the confirmation state is known + // and the confirmation state is confirmed // we skip the `get_message` call if account_messages .iter() - .any(|(id, confirmed)| id == &message_id && confirmed.is_some()) + .any(|(id, confirmed)| id == &message_id && confirmed.unwrap_or(false)) { return crate::Result::Ok((found_output, None)); } @@ -452,11 +452,11 @@ async fn sync_messages( let account = account_handle.read().await.clone(); let client_options = account.client_options().clone(); - let messages_with_known_confirmation: Vec = account + let known_confirmed_messages: Vec = account .with_messages(|messages| { messages .iter() - .filter(|m| m.confirmed.is_some()) + .filter(|m| m.confirmed.unwrap_or(false)) .map(|m| m.key) .collect() }) @@ -492,7 +492,7 @@ async fn sync_messages( continue; } let client = client.clone(); - let messages_with_known_confirmation = messages_with_known_confirmation.clone(); + let known_confirmed_messages = known_confirmed_messages.clone(); let mut outputs = address.outputs.clone(); tasks.push(async move { @@ -573,9 +573,9 @@ async fn sync_messages( outputs.insert(output.id()?, output); // if we already have the message stored - // and the confirmation state is known + // and the confirmation state is confirmed // we skip the `get_message` call - if messages_with_known_confirmation.contains(&output_message_id) { + if known_confirmed_messages.contains(&output_message_id) { continue; }