Modify Transaction::orchard_note_commitments method to not use match_orchard_shielded_data macro from the reverted commit

This commit is contained in:
Dmitry Demin 2024-11-04 13:56:23 +01:00
parent c9c79e63d5
commit 9ad18a4582
1 changed files with 27 additions and 20 deletions

View File

@ -1037,31 +1037,38 @@ impl Transaction {
/// Access the note commitments in this transaction, if there are any,
/// regardless of version.
pub fn orchard_note_commitments(&self) -> Box<dyn Iterator<Item = pallas::Base> + '_> {
match_orchard_shielded_data!(
self,
Box::new(std::iter::empty()),
{ orchard_shielded_data },
Box::new(
match self {
Transaction::V1 { .. }
| Transaction::V2 { .. }
| Transaction::V3 { .. }
| Transaction::V4 { .. } => Box::new(std::iter::empty()),
Transaction::V5 {
orchard_shielded_data,
..
} => Box::new(
orchard_shielded_data
.iter()
.flat_map(orchard::ShieldedData::note_commitments)
.cloned(),
),
#[cfg(feature = "tx-v6")]
Transaction::V6 {
orchard_shielded_data,
orchard_zsa_issue_data,
..
} => Box::new(
orchard_shielded_data
.iter()
.flat_map(orchard::ShieldedData::note_commitments)
.cloned()
.chain(
orchard_zsa_issue_data
.iter()
.flat_map(orchard_zsa::IssueData::note_commitments),
),
),
{ orchard_shielded_data, orchard_zsa_issue_data },
{
Box::new(
orchard_shielded_data
.iter()
.flat_map(orchard::ShieldedData::note_commitments)
.cloned()
.chain(
orchard_zsa_issue_data
.iter()
.flat_map(orchard_zsa::IssueData::note_commitments)
)
)
}
)
}
}
/// Access the [`orchard::Flags`] in this transaction, if there is any,