cuprate_blockchain::ops::blockchain

Function cumulative_generated_coins

Source
pub fn cumulative_generated_coins(
    block_height: &BlockHeight,
    table_block_infos: &impl DatabaseRo<BlockInfos>,
) -> Result<u64, RuntimeError>
Expand description

Check how many cumulative generated coins there have been until a certain BlockHeight.

This returns the total amount of Monero generated up to block_height (including the block itself) in atomic units.

For example:

  • on the genesis block 0, this returns the amount block 0 generated
  • on the next block 1, this returns the amount block 0 and 1 generated

If no blocks have been added and block_height == 0 (i.e., the cumulative generated coins before genesis block is being calculated), this returns Ok(0).

§Errors

This function returns RuntimeError::KeyNotFound if the input (if applicable) doesn’t exist or other RuntimeError’s on database errors.