Enable V5 transaction test vectors in the groth16 tests
This also simplifies the code.
@@ -25,17 +25,10 @@ where
let mut async_checks = FuturesUnordered::new();
for tx in transactions {
- match &*tx {
- Transaction::V1 { .. }
- | Transaction::V2 { .. }
- | Transaction::V3 { .. }
- | Transaction::V5 { .. } => (),
- Transaction::V4 {
- sapling_shielded_data,
- ..
- } => {
- if let Some(sapling_shielded_data) = sapling_shielded_data {
- for spend in sapling_shielded_data.spends_per_anchor() {
+ let spends = tx.sapling_spends_per_anchor();
+ let outputs = tx.sapling_outputs();
+
+ for spend in spends {
tracing::trace!(?spend);
let spend_rsp = spend_verifier
@@ -46,7 +39,7 @@ where
async_checks.push(spend_rsp);
}
- for output in sapling_shielded_data.outputs() {
+ for output in outputs {
tracing::trace!(?output);
let output_rsp = output_verifier
@@ -56,9 +49,6 @@ where
async_checks.push(output_rsp);
}
- }
- }
- }
while let Some(result) = async_checks.next().await {
tracing::trace!(?result);
@@ -108,17 +98,9 @@ where
let mut async_checks = FuturesUnordered::new();
for tx in transactions {
- match &*tx {
- Transaction::V1 { .. }
- | Transaction::V2 { .. }
- | Transaction::V3 { .. }
- | Transaction::V5 { .. } => (),
- Transaction::V4 {
- sapling_shielded_data,
- ..
- } => {
- if let Some(sapling_shielded_data) = sapling_shielded_data {
- for output in sapling_shielded_data.outputs() {
+ let outputs = tx.sapling_outputs();
+
+ for output in outputs {
// This changes the primary inputs to the proof
// verification, causing it to fail for this proof.
let mut modified_output = output.clone();
@@ -133,9 +115,6 @@ where
async_checks.push(output_rsp);
}
- }
- }
- }
while let Some(result) = async_checks.next().await {
result?;
