Line data Source code
1 : #include "fd_voter.h" 2 : 3 : #include "../../funk/fd_funk.h" 4 : #include "../../funk/fd_funk_val.h" 5 : 6 : fd_voter_state_t const * 7 0 : fd_voter_state( fd_funk_t * funk, fd_funk_txn_t const * txn, fd_funk_rec_key_t const * key ) { 8 0 : fd_funk_rec_t const * rec = fd_funk_rec_query_global( funk, txn, key, NULL ); 9 0 : if( FD_UNLIKELY( !rec || !!( rec->flags & FD_FUNK_REC_FLAG_ERASE ) ) ) { 10 0 : return NULL; 11 0 : } 12 0 : fd_account_meta_t const * meta = fd_funk_val_const( rec, fd_funk_wksp(funk) ); 13 0 : FD_TEST( meta->magic == FD_ACCOUNT_META_MAGIC ); 14 0 : fd_voter_state_t const * state = fd_type_pun_const( (uchar const *)meta + meta->hlen ); 15 : #if FD_TOWER_USE_HANDHOLDING 16 : FD_TEST( state->discriminant <= fd_vote_state_versioned_enum_current ); 17 : #endif 18 0 : return state; 19 0 : }