Skip to content

Commit

Permalink
Merge pull request #1537 from AloeareV/second_attempt_rescan_old_outg…
Browse files Browse the repository at this point in the history
…oing_output_indexes

don't touch send flow this time
  • Loading branch information
zancas authored Nov 20, 2024
2 parents 68dba88 + 2c7e45e commit 24a4097
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
10 changes: 8 additions & 2 deletions zingolib/src/wallet/transaction_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
}

Expand Down
23 changes: 23 additions & 0 deletions zingolib/src/wallet/transaction_records_by_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@ impl TransactionRecordsById {
pub fn from_map(map: HashMap<TxId, TransactionRecord>) -> 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.
Expand Down

0 comments on commit 24a4097

Please sign in to comment.