Do not spawn validator backwards pass if count is zero (#2315)

### Description

Fixes a bug in which the validator would panic if the mailbox was empty.

### Drive-by changes

None
pull/2319/head
Asa Oines 2 years ago committed by GitHub
parent e4b124cdde
commit d57ae5f628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      rust/agents/validator/src/validator.rs

@ -152,13 +152,13 @@ impl Validator {
.tree(lag) .tree(lag)
.await .await
.expect("failed to get mailbox tree"); .expect("failed to get mailbox tree");
let backfill_target = submitter.checkpoint(&tip_tree);
let mut tasks = vec![]; let mut tasks = vec![];
let backfill_submitter = submitter.clone();
let legacy_submitter = submitter.clone(); let legacy_submitter = submitter.clone();
if tip_tree.count() > 0 {
let backfill_target = submitter.checkpoint(&tip_tree);
let backfill_submitter = submitter.clone();
tasks.push( tasks.push(
tokio::spawn(async move { tokio::spawn(async move {
backfill_submitter backfill_submitter
@ -167,6 +167,8 @@ impl Validator {
}) })
.instrument(info_span!("BackfillCheckpointSubmitter")), .instrument(info_span!("BackfillCheckpointSubmitter")),
); );
}
tasks.push( tasks.push(
tokio::spawn(async move { submitter.checkpoint_submitter(tip_tree, None).await }) tokio::spawn(async move { submitter.checkpoint_submitter(tip_tree, None).await })
.instrument(info_span!("TipCheckpointSubmitter")), .instrument(info_span!("TipCheckpointSubmitter")),

Loading…
Cancel
Save