diff --git a/zebrad/src/commands/start/sync.rs b/zebrad/src/commands/start/sync.rs index c8fa04f1..1ead8f39 100644 --- a/zebrad/src/commands/start/sync.rs +++ b/zebrad/src/commands/start/sync.rs @@ -9,18 +9,6 @@ use zebra_chain::{block::BlockHeaderHash, types::BlockHeight}; use zebra_network as zn; use zebra_state as zs; -/// Get the heights of the blocks for constructing a block_locator list -#[allow(dead_code)] -pub fn block_locator_heights(tip_height: BlockHeight) -> impl Iterator { - iter::successors(Some(1u32), |h| h.checked_mul(2)) - .flat_map(move |step| tip_height.0.checked_sub(step)) - .map(BlockHeight) - .chain(iter::once(BlockHeight(0))) -} - -type Error = Box; -type NumReq = u32; - pub struct Syncer where ZN: Service, @@ -305,3 +293,15 @@ where Ok(()) } } + +/// Get the heights of the blocks for constructing a block_locator list +#[allow(dead_code)] +pub fn block_locator_heights(tip_height: BlockHeight) -> impl Iterator { + iter::successors(Some(1u32), |h| h.checked_mul(2)) + .flat_map(move |step| tip_height.0.checked_sub(step)) + .map(BlockHeight) + .chain(iter::once(BlockHeight(0))) +} + +type Error = Box; +type NumReq = u32;