From a767aecb9afab3f17ea32f1cff57a87e9d30d84d Mon Sep 17 00:00:00 2001 From: Joseph Livesey Date: Fri, 3 Mar 2023 10:06:11 -0500 Subject: [PATCH] fix(commit_store): fix skip_while_next warning on get_batch_by_transaction Signed-off-by: Joseph Livesey --- validator/src/journal/commit_store.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/validator/src/journal/commit_store.rs b/validator/src/journal/commit_store.rs index 30e8a3ebab..79cd1b3e72 100644 --- a/validator/src/journal/commit_store.rs +++ b/validator/src/journal/commit_store.rs @@ -332,13 +332,12 @@ impl CommitStore { block .batches .into_iter() - .skip_while(|batch| { + .find(|batch| { batch .transaction_ids .iter() - .all(|txn_id| txn_id != transaction_id) + .any(|txn_id| txn_id == transaction_id) }) - .next() .ok_or_else(|| { DatabaseError::CorruptionError("Transaction index corrupted".into()) }) @@ -616,13 +615,12 @@ mod tests { block .batches .into_iter() - .skip_while(|batch| { + .find(|batch| { batch .transaction_ids .iter() - .all(|txn_id| txn_id != transaction_id) + .any(|txn_id| txn_id == transaction_id) }) - .next() .ok_or_else(|| DatabaseError::CorruptionError("Transaction index corrupted".into())) // }) }