Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_stakes_fd_stakes_h 2 : #define HEADER_fd_src_flamenco_stakes_fd_stakes_h 3 : 4 : #include "../fd_flamenco_base.h" 5 : #include "../types/fd_types.h" 6 : #include "fd_stake_delegations.h" 7 : 8 0 : #define FD_STAKE_STATE_V2_SZ (200UL) 9 : 10 : FD_PROTOTYPES_BEGIN 11 : 12 : int 13 : fd_stakes_new_warmup_cooldown_rate_epoch( 14 : fd_epoch_schedule_t const * epoch_schedule, 15 : fd_features_t const * features, 16 : /* out */ ulong * epoch, 17 : int * err 18 : ); 19 : 20 : void 21 : fd_stakes_config_init( fd_accdb_user_t * accdb, 22 : fd_funk_txn_xid_t const * xid ); 23 : 24 : int 25 : fd_stakes_get_state( fd_account_meta_t const * meta, 26 : fd_stake_state_v2_t * out ); 27 : 28 : fd_stake_history_entry_t 29 : fd_stakes_activating_and_deactivating( fd_stake_delegation_t const * self, 30 : ulong target_epoch, 31 : fd_stake_history_t const * stake_history, 32 : ulong * new_rate_activation_epoch ); 33 : 34 : /* fd_stake_weights_by_node converts Stakes (unordered list of (vote 35 : acc, active stake) tuples) to an ordered list of (stake, vote pubkey, node 36 : identity) sorted by (stake descending, vote pubkey descending). 37 : 38 : weights points to an array suitable to hold ... 39 : 40 : fd_vote_accounts_pair_t_map_size( accs->vote_accounts_pool, 41 : accs->vote_accounts_root ) 42 : 43 : ... items. On return, weights be an ordered list. 44 : 45 : Returns the number of items in weights (which is <= no of vote accs). */ 46 : 47 : ulong 48 : fd_stake_weights_by_node( fd_vote_stakes_t * vote_stakes, 49 : ushort fork_idx, 50 : fd_vote_stake_weight_t * weights ); 51 : 52 : 53 : ulong 54 : fd_stake_weights_by_node_next( fd_vote_stakes_t * vote_stakes, 55 : ushort fork_idx, 56 : fd_vote_stake_weight_t * weights ); 57 : 58 : void 59 : fd_stakes_activate_epoch( fd_bank_t * bank, 60 : fd_runtime_stack_t * runtime_stack, 61 : fd_accdb_user_t * accdb, 62 : fd_funk_txn_xid_t const * xid, 63 : fd_capture_ctx_t * capture_ctx, 64 : fd_stake_delegations_t const * stake_delegations, 65 : ulong * new_rate_activation_epoch ); 66 : 67 : void 68 : fd_refresh_vote_accounts( fd_bank_t * bank, 69 : fd_accdb_user_t * accdb, 70 : fd_funk_txn_xid_t const * xid, 71 : fd_runtime_stack_t * runtime_stack, 72 : fd_stake_delegations_t const * stake_delegations, 73 : fd_stake_history_t const * history, 74 : ulong * new_rate_activation_epoch ); 75 : 76 : /* fd_stakes_update_delegation is used to maintain the in-memory cache 77 : of the stake delegations that is used at the epoch boundary. Entries 78 : in the cache will be inserted/updated/removed based on the state of 79 : the stake account. */ 80 : 81 : void 82 : fd_stakes_update_stake_delegation( fd_pubkey_t const * pubkey, 83 : fd_account_meta_t const * meta, 84 : fd_bank_t * bank ); 85 : 86 : FD_PROTOTYPES_END 87 : 88 : #endif /* HEADER_fd_src_flamenco_stakes_fd_stakes_h */