pub fn update_from_hook_output(&mut self, output: hook::Output) -> Result<(), StateError> {
        let hook_height = output.latest_block_height.value();
        let last_height = self.consensus_state.height.value();

        if hook_height > last_height {
            let delta = hook_height - last_height;

            if delta < hook::BLOCK_HEIGHT_SANITY_LIMIT {
                let mut new_state = consensus::State::default();
                new_state.height = output.latest_block_height;
                self.consensus_state = new_state;

                info!("updated block height from hook: {}", hook_height);
            } else {
                warn!(
                    "hook block height more than sanity limit: {} (delta: {}, max: {})",
                    output.latest_block_height,
                    delta,
                    hook::BLOCK_HEIGHT_SANITY_LIMIT
                );
            }
        } else {
            warn!(
                "hook block height less than current? current: {}, hook: {}",
                last_height, hook_height
            );
        }

        Ok(())
    }
/// Update the internal state from the output from a hook command
Update the internal state from the output from a hook command
Update the internal state from the output from a hook command
pub fn update_from_hook_output(&mut self, output: hook::Output) -> Result<(), StateError> {
        let hook_height = output.latest_block_height.value();
        let last_height = self.consensus_state.height.value();
        if hook_height > last_height {
            let delta = hook_height - last_height;
            if delta < hook::BLOCK_HEIGHT_SANITY_LIMIT {
                let mut new_state = consensus::State::default();
                new_state.height = output.latest_block_height;
                self.consensus_state = new_state;
                info!("updated block height from hook: {}", hook_height);
            } else {
                warn!(
                    "hook block height more than sanity limit: {} (delta: {}, max: {})",
                    output.latest_block_height,
                    delta,
                    hook::BLOCK_HEIGHT_SANITY_LIMIT
                );
            }
        } else {
            warn!(
                "hook block height less than current? current: {}, hook: {}",
                last_height, hook_height
            );
        }
        Ok(())
    }
pub fn update_from_hook_output ( & mut self , output : hook :: Output ) -> Result < ( ) , StateError > { let hook_height = output . latest_block_height . value ( ) ; let last_height = self . consensus_state . height . value ( ) ; if hook_height > last_height { let delta = hook_height - last_height ; if delta < hook :: BLOCK_HEIGHT_SANITY_LIMIT { let mut new_state = consensus :: State :: default ( ) ; new_state . height = output . latest_block_height ; self . consensus_state = new_state ; info ! ( " " hook_height ) ; } else { warn ! ( " " output latest_block_height delta hook BLOCK_HEIGHT_SANITY_LIMIT ) ; } } else { warn ! ( " " last_height hook_height ) ; } Ok ( ( ) ) }
Update the internal state from the output from a hook command
Update the internal state from the output from a hook command
&mut self
output
hook::Output