6inline uint32_t block_height_from_id(
const sysio::checksum256& block_id)
8 auto arr = block_id.extract_as_byte_array();
10 return ((arr[0] << 0x18) | (arr[1] << 0x10) | (arr[2] << 0x08) | arr[3]);
17void system_contract::add_to_blockinfo_table(
const sysio::checksum256& previous_block_id,
20 const uint32_t new_block_height = block_height_from_id(previous_block_id) + 1;
25 if (block_info::rolling_window_size > 0) {
28 r.block_height = new_block_height;
29 r.block_timestamp = new_block_timestamp;
35 const uint32_t last_prunable_block_height =
36 std::max(new_block_height, block_info::rolling_window_size) - block_info::rolling_window_size;
39 for (
auto itr = t.begin(), end = t.end();
40 itr != end && itr->block_height <= last_prunable_block_height && 0 <
count;
sysio::multi_index<"blockinfo"_n, block_info_record > block_info_table