From c0b35bdb444756b9309753558b83634ce5a4f0c9 Mon Sep 17 00:00:00 2001 From: Hazel OHearn Date: Tue, 19 Nov 2024 14:23:44 -0400 Subject: [PATCH] don't touch send flow this time --- zingolib/src/wallet/transaction_context.rs | 10 ++++++-- .../src/wallet/transaction_records_by_id.rs | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/zingolib/src/wallet/transaction_context.rs b/zingolib/src/wallet/transaction_context.rs index b348c7414..c26cdd37c 100644 --- a/zingolib/src/wallet/transaction_context.rs +++ b/zingolib/src/wallet/transaction_context.rs @@ -40,16 +40,22 @@ impl TransactionContext { &self, wallet_height: BlockHeight, ) -> Result<(), Vec<(TxId, BlockHeight)>> { - self.transaction_metadata_set + let tmdsrl = &self + .transaction_metadata_set .read() .await - .transaction_records_by_id + .transaction_records_by_id; + tmdsrl .get_spendable_note_ids_and_values( &[ShieldedProtocol::Sapling, ShieldedProtocol::Orchard], wallet_height, &[], ) .map(|_| ()) + .map_err(|mut vec| { + vec.extend_from_slice(&tmdsrl.missing_outgoing_output_indexes()); + vec + }) } } diff --git a/zingolib/src/wallet/transaction_records_by_id.rs b/zingolib/src/wallet/transaction_records_by_id.rs index 24e6fd496..e8d9f9204 100644 --- a/zingolib/src/wallet/transaction_records_by_id.rs +++ b/zingolib/src/wallet/transaction_records_by_id.rs @@ -58,6 +58,29 @@ impl TransactionRecordsById { pub fn from_map(map: HashMap) -> Self { TransactionRecordsById(map) } + + pub(crate) fn missing_outgoing_output_indexes(&self) -> Vec<(TxId, BlockHeight)> { + self.values() + .flat_map(|transaction_record| { + if transaction_record.status.is_confirmed() { + if transaction_record + .outgoing_tx_data + .iter() + .any(|outgoing_tx_data| outgoing_tx_data.output_index.is_none()) + { + Some(( + transaction_record.txid, + transaction_record.status.get_height(), + )) + } else { + None + } + } else { + None + } + }) + .collect() + } } /// Methods to query and modify the map.