Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't touch send flow this time #1537

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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