Module solana_program::sysvar::last_restart_slot

source ·
Expand description

Information about the last restart slot (hard fork).

The last restart sysvar provides access to the last restart slot kept in the bank fork for the slot on the fork that executes the current transaction. In case there was no fork it returns 0.

LastRestartSlot implements Sysvar::get and can be loaded efficiently without passing the sysvar account ID to the program.

See also the Solana SIMD proposal.

§Examples

Accessing via on-chain program directly:


fn process_instruction(
    program_id: &Pubkey,
    accounts: &[AccountInfo],
    instruction_data: &[u8],
) -> ProgramResult {

    let last_restart_slot = LastRestartSlot::get();
    msg!("last restart slot: {:?}", last_restart_slot);

    Ok(())
}

Re-exports§

Constants§

  • The const program ID.

Functions§

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