Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_slot_history_h 2 : #define HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_slot_history_h 3 : 4 : #include "../fd_bank.h" 5 : 6 21 : #define FD_SLOT_HISTORY_SLOT_FOUND (0) 7 21 : #define FD_SLOT_HISTORY_SLOT_FUTURE (-1) 8 27 : #define FD_SLOT_HISTORY_SLOT_NOT_FOUND (-2) 9 12 : #define FD_SLOT_HISTORY_SLOT_TOO_OLD (-3) 10 : 11 : /* https://github.com/solana-labs/solana/blob/v1.18.26/sdk/program/src/slot_history.rs#L43 */ 12 4002 : #define FD_SLOT_HISTORY_MAX_ENTRIES (1024UL * 1024UL) 13 : 14 : struct fd_slot_history_view { 15 : uchar const * bits; 16 : ulong blocks_len; 17 : ulong bits_len; 18 : ulong next_slot; 19 : }; 20 : typedef struct fd_slot_history_view fd_slot_history_view_t; 21 : 22 : FD_PROTOTYPES_BEGIN 23 : 24 : void 25 : fd_sysvar_slot_history_init( fd_bank_t * bank, 26 : fd_accdb_t * accdb, 27 : fd_capture_ctx_t * capture_ctx ); 28 : 29 : void 30 : fd_sysvar_slot_history_update( fd_bank_t * bank, 31 : fd_accdb_t * accdb, 32 : fd_capture_ctx_t * capture_ctx ); 33 : 34 : int 35 : fd_sysvar_slot_history_validate( uchar const * data, 36 : ulong sz ); 37 : 38 : fd_slot_history_view_t * 39 : fd_sysvar_slot_history_view( fd_slot_history_view_t * view, 40 : uchar const * data, 41 : ulong sz ); 42 : 43 : /* Returns FD_SLOT_HISTORY_SLOT_*. */ 44 : int 45 : fd_sysvar_slot_history_find_slot( fd_slot_history_view_t const * view, 46 : ulong slot ); 47 : 48 : FD_PROTOTYPES_END 49 : 50 : #endif /* HEADER_fd_src_flamenco_runtime_sysvar_fd_sysvar_slot_history_h */