From 5bb90015dc636aa4c0916e7072724ae7fc03e8e4 Mon Sep 17 00:00:00 2001 From: Alexis Asseman Date: Mon, 20 Nov 2023 17:18:52 -0800 Subject: [PATCH] feat!: create_rav_request() returns invalid ReceivedReceipt Helps the user determine why the receipts failed, because ReceivedReceipt contains the status of checks. Signed-off-by: Alexis Asseman --- tap_core/src/tap_manager/manager.rs | 6 +++--- tap_core/src/tap_manager/rav_request.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tap_core/src/tap_manager/manager.rs b/tap_core/src/tap_manager/manager.rs index dd984a75..d490614c 100644 --- a/tap_core/src/tap_manager/manager.rs +++ b/tap_core/src/tap_manager/manager.rs @@ -216,7 +216,7 @@ impl< &self, timestamp_buffer_ns: u64, min_timestamp_ns: u64, - ) -> Result<(Vec, Vec), Error> { + ) -> Result<(Vec, Vec), Error> { let max_timestamp_ns = crate::get_current_timestamp_u64_ns()? - timestamp_buffer_ns; if min_timestamp_ns > max_timestamp_ns { @@ -234,7 +234,7 @@ impl< })?; let mut accepted_signed_receipts = Vec::::new(); - let mut failed_signed_receipts = Vec::::new(); + let mut failed_signed_receipts = Vec::::new(); let mut received_receipts: Vec = received_receipts.into_iter().map(|e| e.1).collect(); @@ -252,7 +252,7 @@ impl< if received_receipt.is_accepted() { accepted_signed_receipts.push(received_receipt.signed_receipt); } else { - failed_signed_receipts.push(received_receipt.signed_receipt); + failed_signed_receipts.push(received_receipt); } } diff --git a/tap_core/src/tap_manager/rav_request.rs b/tap_core/src/tap_manager/rav_request.rs index c976af5a..68a3b7b6 100644 --- a/tap_core/src/tap_manager/rav_request.rs +++ b/tap_core/src/tap_manager/rav_request.rs @@ -4,13 +4,13 @@ use serde::{Deserialize, Serialize}; use super::{SignedRAV, SignedReceipt}; -use crate::receipt_aggregate_voucher::ReceiptAggregateVoucher; +use crate::{receipt_aggregate_voucher::ReceiptAggregateVoucher, tap_receipt::ReceivedReceipt}; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct RAVRequest { pub valid_receipts: Vec, pub previous_rav: Option, - pub invalid_receipts: Vec, + pub invalid_receipts: Vec, pub expected_rav: ReceiptAggregateVoucher, }