Replace Target<block::Height> with TargetHeight (#1289)
We don't use this generic, so let's just remove it.
This commit is contained in:
parent
4e07719a7d
commit
af4797130b
|
|
@ -44,7 +44,7 @@ mod tests;
|
|||
|
||||
pub(crate) use list::CheckpointList;
|
||||
use types::{Progress, Progress::*};
|
||||
use types::{Target, Target::*};
|
||||
use types::{TargetHeight, TargetHeight::*};
|
||||
|
||||
/// An unverified block, which is in the queue for checkpoint verification.
|
||||
#[derive(Debug)]
|
||||
|
|
@ -262,7 +262,7 @@ where
|
|||
/// `height` increases as checkpoints are verified.
|
||||
///
|
||||
/// If verification has finished, returns `FinishedVerifying`.
|
||||
fn target_checkpoint_height(&self) -> Target<block::Height> {
|
||||
fn target_checkpoint_height(&self) -> TargetHeight {
|
||||
// Find the height we want to start searching at
|
||||
let start_height = match self.previous_checkpoint_height() {
|
||||
// Check if we have the genesis block as a special case, to simplify the loop
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use super::*;
|
||||
|
||||
use super::types::Progress::*;
|
||||
use super::types::Target::*;
|
||||
use super::types::TargetHeight::*;
|
||||
|
||||
use color_eyre::eyre::{eyre, Report};
|
||||
use futures::{future::TryFutureExt, stream::FuturesUnordered};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use std::cmp::Ordering;
|
|||
use zebra_chain::block;
|
||||
|
||||
use Progress::*;
|
||||
use Target::*;
|
||||
use TargetHeight::*;
|
||||
|
||||
/// A `CheckpointVerifier`'s current progress verifying the chain.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
|
|
@ -62,16 +62,17 @@ impl PartialOrd for Progress<block::Height> {
|
|||
}
|
||||
}
|
||||
|
||||
/// A `CheckpointVerifier`'s target checkpoint, based on the current queue.
|
||||
/// A `CheckpointVerifier`'s target checkpoint height, based on the current
|
||||
/// queue.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum Target<HeightOrHash> {
|
||||
pub enum TargetHeight {
|
||||
/// We need more blocks before we can choose a target checkpoint.
|
||||
WaitingForBlocks,
|
||||
/// We want to verify this checkpoint.
|
||||
///
|
||||
/// The target checkpoint can be multiple checkpoints ahead of the previous
|
||||
/// checkpoint.
|
||||
Checkpoint(HeightOrHash),
|
||||
Checkpoint(block::Height),
|
||||
/// We have finished verifying, there will be no more targets.
|
||||
FinishedVerifying,
|
||||
}
|
||||
|
|
@ -79,7 +80,7 @@ pub enum Target<HeightOrHash> {
|
|||
/// Block height target, in chain order.
|
||||
///
|
||||
/// `WaitingForBlocks` is incomparable with itself and `Checkpoint(_)`.
|
||||
impl PartialOrd for Target<block::Height> {
|
||||
impl PartialOrd for TargetHeight {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
match (self, other) {
|
||||
// FinishedVerifying is the final state
|
||||
|
|
|
|||
Loading…
Reference in New Issue