pub type EpochNumberWithFraction = Uint64;
Expand description
The epoch indicator of a block. It shows which epoch the block is in, and the elapsed epoch fraction after adding this block.
This is a 64-bit unsigned integer type encoded as the 0x-prefixed hex string in JSON. See examples of Uint64.
The lower 56 bits of the epoch field are split into 3 parts (listed in the order from higher bits to lower bits):
- The highest 16 bits represent the epoch length
- The next 16 bits represent the current block index in the epoch, starting from 0.
- The lowest 24 bits represent the current epoch number.
Assume there’s a block, which number is 11555 and in epoch 50. The epoch 50 starts from block 11000 and have 1000 blocks. The epoch field for this particular block will then be 1,099,520,939,130,930, which is calculated in the following way:
50 | ((11555 - 11000) << 24) | (1000 << 40)
Aliased Type§
struct EpochNumberWithFraction(/* private fields */);
Trait Implementations§
Source§impl AsEpochNumberWithFraction for EpochNumberWithFraction
impl AsEpochNumberWithFraction for EpochNumberWithFraction
Source§fn epoch_number(&self) -> u64
fn epoch_number(&self) -> u64
Return the epoch number of current block
Source§fn epoch_index(&self) -> u64
fn epoch_index(&self) -> u64
Return the index in epoch of current block
Source§fn epoch_length(&self) -> u64
fn epoch_length(&self) -> u64
Return the epoch length of current block