solana_sdk::sysvar

Module slot_history

source
Expand description

A bitvector of slots present over the last epoch.

The slot history sysvar provides access to the SlotHistory type.

The Sysvar::from_account_info and Sysvar::get methods always return ProgramError::UnsupportedSysvar because this sysvar account is too large to process on-chain. Thus this sysvar cannot be accessed on chain, though one can still use the SysvarId::id, SysvarId::check_id and Sysvar::size_of methods in an on-chain program, and it can be accessed off-chain through RPC.

§Examples

Calling via the RPC client:

fn print_sysvar_slot_history(client: &RpcClient) -> Result<()> {
    let slot_history = client.get_account(&slot_history::ID)?;
    let data: SlotHistory = bincode::deserialize(&slot_history.data)?;

    Ok(())
}

Structs§

Enums§

Constants§

  • The const program ID.

Functions§

  • Returns true if given pubkey is the program ID.
  • Returns the program ID.