From 9a176135da090574a5f96d8ff3c472f4db377e9d Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Tue, 16 Jan 2024 21:08:42 +0000 Subject: [PATCH 1/2] propagate an error in mark_note_as_spent --- zingolib/src/blaze/update_notes.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zingolib/src/blaze/update_notes.rs b/zingolib/src/blaze/update_notes.rs index 002749018..84792b3fa 100644 --- a/zingolib/src/blaze/update_notes.rs +++ b/zingolib/src/blaze/update_notes.rs @@ -1,3 +1,4 @@ +use crate::error::ZingoLibResult; use crate::wallet::MemoDownloadOption; use crate::wallet::{ data::PoolNullifier, transactions::TransactionMetadataSet, utils::txid_from_slice, @@ -88,7 +89,8 @@ impl UpdateNotes { let wallet_transactions = self.transaction_metadata_set.clone(); let h1 = tokio::spawn(async move { - let mut workers = FuturesUnordered::new(); + let mut workers: FuturesUnordered>> = + FuturesUnordered::new(); // Receive Txns that are sent to the wallet. We need to update the notes for this. while let Some(( @@ -139,7 +141,7 @@ impl UpdateNotes { maybe_spend_nullifier, transaction_id_spent_from, output_index, - ); + )?; drop(wallet_transactions_write_unlocked); @@ -156,21 +158,23 @@ impl UpdateNotes { .send((transaction_id_spent_from, at_height)) .unwrap(); } + Ok(()) })); } // Wait for all the workers while let Some(r) = workers.next().await { - r.unwrap(); + r.unwrap()?; } //info!("Finished Note Update processing"); + Ok(()) }); let h = tokio::spawn(async move { let (r0, r1) = join!(h0, h1); r0.map_err(|e| format!("{}", e))??; - r1.map_err(|e| format!("{}", e)) + r1.map_err(|e| format!("{}", e))? }); (h, blocks_done_transmitter, transmitter) From d26901e10ffcdb10ef09d1a84ae152af73aaf676 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Thu, 18 Jan 2024 19:14:48 +0000 Subject: [PATCH 2/2] implement clippy suggestion --- zingolib/src/blaze/update_notes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zingolib/src/blaze/update_notes.rs b/zingolib/src/blaze/update_notes.rs index 84792b3fa..c11d562f1 100644 --- a/zingolib/src/blaze/update_notes.rs +++ b/zingolib/src/blaze/update_notes.rs @@ -134,7 +134,7 @@ impl UpdateNotes { // Record the future transaction, the one that has spent the nullifiers received in this transaction in the wallet let status = ConfirmationStatus::Confirmed(spent_at_height); - let _ = wallet_transactions_write_unlocked.found_spent_nullifier( + wallet_transactions_write_unlocked.found_spent_nullifier( transaction_id_spent_in, status, ts,