Skip to content

Commit

Permalink
Inline prior_batch calculation to prevent panic on rotation
Browse files Browse the repository at this point in the history
Noticed when doing a final review of the branch.
  • Loading branch information
kayabaNerve committed Nov 15, 2023
1 parent 45a8b62 commit c8dda2b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions coordinator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,10 +655,9 @@ async fn handle_processor_message<D: Db, P: P2p>(
MainDb::<D>::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::<D>::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
Expand Down

0 comments on commit c8dda2b

Please sign in to comment.