pub fn load_block_range(
        &self,
        max_block: BlockNumber,
        limit: u32,
    ) -> QueryResult<Vec<BlockDetails>> {
        // This query does the following:
        // - joins the `operations` and `eth_tx_hashes` (using the intermediate `eth_ops_binding` table)
        //   tables to collect the data:
        //   block number, ethereum transaction hash, action type and action creation timestamp;
        // - joins the `blocks` table with result of the join twice: once for committed operations
        //   and verified operations;
        // - collects the {limit} blocks in the descending order with the data gathered above.
        let query = format!(
            " \
            with eth_ops as ( \
                select distinct on (block_number, action_type) \
                    operations.block_number, \
                    eth_tx_hashes.tx_hash, \
                    operations.action_type, \
                    operations.created_at, \
                    confirmed \
                from operations \
                    left join eth_ops_binding on eth_ops_binding.op_id = operations.id \
                    left join eth_tx_hashes on eth_tx_hashes.eth_op_id = eth_ops_binding.eth_op_id \
                order by block_number desc, action_type, confirmed \
            ) \
            select \
                blocks.number as block_number, \
                blocks.root_hash as new_state_root, \
                blocks.block_size as block_size, \
                committed.tx_hash as commit_tx_hash, \
                verified.tx_hash as verify_tx_hash, \
                committed.created_at as committed_at, \
                verified.created_at as verified_at \
            from blocks \
            inner join eth_ops committed on \
                committed.block_number = blocks.number and committed.action_type = 'COMMIT' \
            left join eth_ops verified on \
                verified.block_number = blocks.number and verified.action_type = 'VERIFY' and verified.confirmed = true \
            where \
                blocks.number <= {max_block} \
            order by blocks.number desc \
            limit {limit}; \
            ",
            max_block = i64::from(max_block),
            limit = i64::from(limit)
        );
        diesel::sql_query(query).load(self.0.conn())
    }
/// Loads the block headers for the given amount of blocks.
Loads the block headers for the given amount of blocks.
Loads the block headers for the given amount of blocks .
pub fn load_block_range(
        &self,
        max_block: BlockNumber,
        limit: u32,
    ) -> QueryResult<Vec<BlockDetails>> {
        // This query does the following:
        // - joins the `operations` and `eth_tx_hashes` (using the intermediate `eth_ops_binding` table)
        //   tables to collect the data:
        //   block number, ethereum transaction hash, action type and action creation timestamp;
        // - joins the `blocks` table with result of the join twice: once for committed operations
        //   and verified operations;
        // - collects the {limit} blocks in the descending order with the data gathered above.
        let query = format!(
            " \
            with eth_ops as ( \
                select distinct on (block_number, action_type) \
                    operations.block_number, \
                    eth_tx_hashes.tx_hash, \
                    operations.action_type, \
                    operations.created_at, \
                    confirmed \
                from operations \
                    left join eth_ops_binding on eth_ops_binding.op_id = operations.id \
                    left join eth_tx_hashes on eth_tx_hashes.eth_op_id = eth_ops_binding.eth_op_id \
                order by block_number desc, action_type, confirmed \
            ) \
            select \
                blocks.number as block_number, \
                blocks.root_hash as new_state_root, \
                blocks.block_size as block_size, \
                committed.tx_hash as commit_tx_hash, \
                verified.tx_hash as verify_tx_hash, \
                committed.created_at as committed_at, \
                verified.created_at as verified_at \
            from blocks \
            inner join eth_ops committed on \
                committed.block_number = blocks.number and committed.action_type = 'COMMIT' \
            left join eth_ops verified on \
                verified.block_number = blocks.number and verified.action_type = 'VERIFY' and verified.confirmed = true \
            where \
                blocks.number <= {max_block} \
            order by blocks.number desc \
            limit {limit}; \
            ",
            max_block = i64::from(max_block),
            limit = i64::from(limit)
        );
        diesel::sql_query(query).load(self.0.conn())
    }
pub fn load_block_range ( & self , max_block : BlockNumber , limit : u32 , ) -> QueryResult < Vec < BlockDetails > > { // This query does the following: // - joins the `operations` and `eth_tx_hashes` (using the intermediate `eth_ops_binding` table) //   tables to collect the data: //   block number, ethereum transaction hash, action type and action creation timestamp; // - joins the `blocks` table with result of the join twice: once for committed operations //   and verified operations; // - collects the {limit} blocks in the descending order with the data gathered above. let query = format ! ( " \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 \
 " max_block i64 from ( max_block ) limit i64 from ( limit ) ) ; diesel :: sql_query ( query ) . load ( self . 0 . conn ( ) ) }
Loads the block headers for the given amount of blocks.
Loads the block headers for the given amount of blocks .
&self
max_block
BlockNumber
limit
u32