LCOV - code coverage report
Current view: top level - flamenco/stakes - fd_stake_delegations_private.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 14 21 66.7 %
Date: 2026-10-23 16:36:47 Functions: 4 153 2.6 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_stakes_fd_stake_delegations_private_h
       2             : #define HEADER_fd_src_flamenco_stakes_fd_stake_delegations_private_h
       3             : 
       4             : FD_PROTOTYPES_BEGIN
       5             : 
       6             : void
       7             : fd_stake_delegations_iter_read_disk_delta_private( fd_stake_delegations_iter_t * iter,
       8             :                                                    uint                          delta_idx );
       9             : 
      10             : void
      11             : fd_stake_delegations_iter_advance_disk_root_private( fd_stake_delegations_iter_t * iter );
      12             : 
      13             : /* Advance to the next live (in_use), non-tombstone root pool
      14             :    delegation, or to the watermark if none remain.  Redirects to the
      15             :    delta pool if there's a fork delta.  Inlined for the boundary hot
      16             :    path.  DO NOT un-inline. */
      17             : 
      18             : static inline void
      19        2935 : fd_stake_delegations_iter_advance_private( fd_stake_delegations_iter_t * iter ) {
      20        2935 :   while( iter->idx<iter->wmk ) {
      21        2119 :     fd_stake_delegation_t * root_delegation = iter->root_pool+iter->idx;
      22        2119 :     if( FD_LIKELY( root_delegation->in_use ) ) {
      23        2119 :       if( FD_UNLIKELY( root_delegation->delta_idx!=UINT_MAX &&
      24        2119 :                        (root_delegation->delta_idx & FD_STAKE_DELEGATIONS_DELTA_DISK_TAG) ) ) {
      25           0 :         fd_stake_delegations_iter_read_disk_delta_private( iter, root_delegation->delta_idx & FD_STAKE_DELEGATIONS_DELTA_IDX_MASK );
      26           0 :         if( FD_LIKELY( iter->ele ) ) return;
      27           0 :         iter->idx++;
      28           0 :         continue;
      29           0 :       }
      30        2119 :       fd_stake_delegation_t * ele = root_delegation->delta_idx!=UINT_MAX ? iter->delta_pool+root_delegation->delta_idx : root_delegation;
      31        2119 :       if( FD_LIKELY( !ele->is_tombstone ) ) {
      32        2119 :         iter->ele = ele;
      33        2119 :         return;
      34        2119 :       }
      35        2119 :     }
      36           0 :     iter->idx++;
      37           0 :   }
      38         816 :   fd_stake_delegations_iter_advance_disk_root_private( iter );
      39         816 : }
      40             : 
      41             : FD_PROTOTYPES_END
      42             : 
      43             : #endif /* HEADER_fd_src_flamenco_stakes_fd_stake_delegations_private_h */

Generated by: LCOV version 1.14