From c8dda2b52baed599de460bfd0824c416e02d84db Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 15 Nov 2023 15:11:58 -0500 Subject: [PATCH] Inline prior_batch calculation to prevent panic on rotation Noticed when doing a final review of the branch. --- coordinator/src/main.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coordinator/src/main.rs b/coordinator/src/main.rs index 3ce46e241..be549d771 100644 --- a/coordinator/src/main.rs +++ b/coordinator/src/main.rs @@ -655,10 +655,9 @@ async fn handle_processor_message( MainDb::::set_handover_batch(&mut txn, spec.set(), last_received); // If this isn't the first batch, meaning we do have to verify all prior batches, and // the prior Batch hasn't been verified yet... - let prior_batch = last_received - 1; if (last_received != 0) && MainDb::::last_verified_batch(&txn, msg.network) - .map(|last_verified| last_verified < prior_batch) + .map(|last_verified| last_verified < (last_received - 1)) .unwrap_or(true) { // Withhold this TX until we verify all prior `Batch`s