Line data Source code
1 : #ifndef HEADER_fd_flamenco_stakes_fd_stake_weight_h 2 : #define HEADER_fd_flamenco_stakes_fd_stake_weight_h 3 : 4 : /* fd_stake_weight.h provides utils for dealing with stake weight sets. */ 5 : 6 : #include "../fd_flamenco_base.h" 7 : 8 : struct fd_stake_weight { 9 : fd_pubkey_t key; /* validator identity pubkey */ 10 : ulong stake; /* total stake by identity */ 11 : }; 12 : typedef struct fd_stake_weight fd_stake_weight_t; 13 : 14 : #define SORT_NAME fd_stake_weight_key_sort 15 0 : #define SORT_KEY_T fd_stake_weight_t 16 0 : #define SORT_BEFORE(a,b) (memcmp( (a).key.uc, (b).key.uc, 32UL )<0) 17 : #include "../../util/tmpl/fd_sort.c" 18 : 19 : struct fd_vote_stake_weight { 20 : fd_pubkey_t vote_key; /* vote account pubkey */ 21 : fd_pubkey_t id_key; /* validator identity pubkey */ 22 : ulong stake; /* total stake by vote account */ 23 : }; 24 : typedef struct fd_vote_stake_weight fd_vote_stake_weight_t; 25 : 26 : #define SORT_NAME sort_vote_weights_by_stake_vote 27 12 : #define SORT_KEY_T fd_vote_stake_weight_t 28 6 : #define SORT_BEFORE(a,b) ((a).stake > (b).stake ? 1 : ((a).stake < (b).stake ? 0 : memcmp( (a).vote_key.uc, (b).vote_key.uc, 32UL )>0)) 29 : #include "../../util/tmpl/fd_sort.c" 30 : 31 : #endif /* HEADER_fd_flamenco_stakes_fd_stake_weight_h */