fn check_block_range(
        conn: &StorageProcessor,
        max_block: BlockNumber,
        limit: u32,
    ) -> diesel::QueryResult<()> {
        let start_block = if max_block >= limit {
            (max_block - limit) + 1
        } else {
            1
        };
        let block_range = BlockSchema(conn).load_block_range(max_block, limit)?;
        // Go in the reversed order, since the blocks themselves are ordered backwards.
        for (idx, block_number) in (start_block..=max_block).rev().enumerate() {
            let expected = BlockSchema(&conn)
                .find_block_by_height_or_hash(block_number.to_string())
                .unwrap_or_else(|| {
                    panic!(format!(
                        "Can't load the existing block with the index {}",
                        block_number
                    ))
                });
            let got = &block_range[idx];
            assert_eq!(got, &expected);
        }

        Ok(())
    }
/// Loads the block range and checks that every block in the response is
/// equal to the one obtained from `find_block_by_height_or_hash` method.
Loads the block range and checks that every block in the response is
equal to the one obtained from `find_block_by_height_or_hash` method.
Loads the block range and checks that every block in the response is equal to the one obtained from ` find_block_by_height_or_hash ` method .
fn check_block_range(
        conn: &StorageProcessor,
        max_block: BlockNumber,
        limit: u32,
    ) -> diesel::QueryResult<()> {
        let start_block = if max_block >= limit {
            (max_block - limit) + 1
        } else {
            1
        };
        let block_range = BlockSchema(conn).load_block_range(max_block, limit)?;
        // Go in the reversed order, since the blocks themselves are ordered backwards.
        for (idx, block_number) in (start_block..=max_block).rev().enumerate() {
            let expected = BlockSchema(&conn)
                .find_block_by_height_or_hash(block_number.to_string())
                .unwrap_or_else(|| {
                    panic!(format!(
                        "Can't load the existing block with the index {}",
                        block_number
                    ))
                });
            let got = &block_range[idx];
            assert_eq!(got, &expected);
        }
        Ok(())
    }
fn check_block_range ( conn : & StorageProcessor , max_block : BlockNumber , limit : u32 , ) -> diesel :: QueryResult < ( ) > { let start_block = if max_block >= limit { ( max_block - limit ) + 1 } else { 1 } ; let block_range = BlockSchema ( conn ) . load_block_range ( max_block , limit ) ? ; // Go in the reversed order, since the blocks themselves are ordered backwards. for ( idx , block_number ) in ( start_block ..= max_block ) . rev ( ) . enumerate ( ) { let expected = BlockSchema ( & conn ) . find_block_by_height_or_hash ( block_number . to_string ( ) ) . unwrap_or_else ( | | { panic ! ( format ( " " block_number ) ) } ) ; let got = & block_range [ idx ] ; assert_eq ! ( got expected ) ; } Ok ( ( ) ) }
Loads the block range and checks that every block in the response is
equal to the one obtained from `find_block_by_height_or_hash` method.
Loads the block range and checks that every block in the response is equal to the one obtained from ` find_block_by_height_or_hash ` method .
conn
&StorageProcessor
max_block
BlockNumber
limit
u32