COOPENOMICS  v1
Кооперативная Экономика
Пространство имен eosiosystem::block_info

Классы

struct  block_batch_info
 
struct  block_info_record
 
struct  latest_block_batch_info_result
 

Определения типов

using block_info_table = eosio::multi_index<"blockinfo"_n, block_info_record >
 

Функции

latest_block_batch_info_result get_latest_block_batch_info (uint32_t batch_start_height_offset, uint32_t batch_size, eosio::name system_account_name="eosio"_n)
 

Переменные

static constexpr uint32_t rolling_window_size = 10
 

Типы

◆ block_info_table

using eosiosystem::block_info::block_info_table = typedef eosio::multi_index<"blockinfo"_n, block_info_record>

Функции

◆ get_latest_block_batch_info()

latest_block_batch_info_result eosiosystem::block_info::get_latest_block_batch_info ( uint32_t  batch_start_height_offset,
uint32_t  batch_size,
eosio::name  system_account_name = "eosio"_n 
)

Get information on the latest block batch.

A block batch is a contiguous range of blocks of a particular size. A sequence of blocks can be partitioned into a sequence of block batches, where all except for perhaps the last batch in the sequence have the same size. The last batch in the sequence can have a smaller size if the blocks of the blockchain that would complete that batch have not yet been generated or recorded.

This function enables the caller to specify a particular partitioning of the sequence of blocks into a sequence of block batches of a particular non-zero size (batch_size) and then isolates the last block batch in that sequence and returns the information about that latest block batch if possible. The partitioning will ensure that batch_start_height_offset will be equal to the starting block height of exactly one of block batches in the sequence.

The information about the latest block batch is the same data captured in block_batch_info. Particularly, it returns the height and timestamp of starting and ending blocks within that latest block batch. Note that the range spanning from the start to end block of the latest block batch may be less than batch_size because latest block batch may be incomplete. Also, it is possible for the record capturing info for the starting block to not exist in the blockinfo table. This can either be due to the records being erased as they fall out of the rolling window or, in rare cases, due to gaps in block info records due to failures of the onblock action. In such a case, this function will be unable to return a block_batch_info and will instead be forced to return the insufficient_data error code. Furthermore, if batch_start_height_offset is greater than the height of the latest block for which information is recorded in the blockinfo table, there will be no latest block batch identified for the function to return information about and so it will again be forced to return the insufficient_data error code instead.

Переменные

◆ rolling_window_size

constexpr uint32_t eosiosystem::block_info::rolling_window_size = 10
staticconstexpr