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())) // }) }