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