Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_recent_hashes_h 2 : #define HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_recent_hashes_h 3 : 4 : /* fd_sysvar_recent_hashes.h manages the "recent block hashes" sysvar 5 : account (address SysvarRecentB1ockHashes11111111111111111111). */ 6 : 7 : #include "../../types/fd_types.h" 8 : #include "../../fd_flamenco_base.h" 9 : #include "../../accdb/fd_accdb_user.h" 10 : #include "fd_sysvar_base.h" 11 : 12 : /* FD_SYSVAR_RECENT_HASHES_CAP is the max number of block hash entries 13 : the recent blockhashes sysvar will include. 14 : 15 : https://github.com/anza-xyz/agave/blob/6398ddf6ab8a8f81017bf675ab315a70067f0bf0/sdk/program/src/sysvar/recent_blockhashes.rs#L32 16 : */ 17 : 18 69309 : #define FD_SYSVAR_RECENT_HASHES_CAP (150UL) 19 : 20 : FD_PROTOTYPES_BEGIN 21 : 22 : /* The recent hashes sysvar */ 23 : 24 : /* Initialize the recent hashes sysvar account. */ 25 : void 26 : fd_sysvar_recent_hashes_init( fd_bank_t * bank, 27 : fd_accdb_user_t * accdb, 28 : fd_funk_txn_xid_t const * xid, 29 : fd_capture_ctx_t * capture_ctx ); 30 : 31 : /* Update the recent hashes sysvar account. This should be called at the start of every slot, before execution commences. */ 32 : void 33 : fd_sysvar_recent_hashes_update( fd_bank_t * bank, 34 : fd_accdb_user_t * accdb, 35 : fd_funk_txn_xid_t const * xid, 36 : fd_capture_ctx_t * capture_ctx ); 37 : 38 : 39 : /* fd_sysvar_recent_hashes_read reads the recent hashes sysvar from funk. 40 : If the account doesn't exist in funk or if the account has zero 41 : lamports, this function returns NULL. */ 42 : 43 : fd_recent_block_hashes_t * 44 : fd_sysvar_recent_hashes_read( fd_funk_t * funk, 45 : fd_funk_txn_xid_t const * xid, 46 : uchar rbh_mem[ static FD_SYSVAR_RECENT_HASHES_FOOTPRINT ] ); 47 : 48 : FD_PROTOTYPES_END 49 : 50 : #endif /* HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_recent_hashes_h */