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-11-11 12:40:43 Functions: 4 169 2.4 %

          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        2723 : fd_stake_delegations_iter_advance_private( fd_stake_delegations_iter_t * iter ) {
      20        2723 :   while( iter->idx<iter->wmk ) {
      21        1917 :     fd_stake_delegation_t * root_delegation = iter->root_pool+iter->idx;
      22        1917 :     if( FD_LIKELY( root_delegation->in_use ) ) {
      23        1917 :       if( FD_UNLIKELY( root_delegation->delta_idx!=UINT_MAX &&
      24        1917 :                        (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        1917 :       fd_stake_delegation_t * ele = root_delegation->delta_idx!=UINT_MAX ? iter->delta_pool+root_delegation->delta_idx : root_delegation;
      31        1917 :       if( FD_LIKELY( !ele->is_tombstone ) ) {
      32        1917 :         iter->ele = ele;
      33        1917 :         return;
      34        1917 :       }
      35        1917 :     }
      36           0 :     iter->idx++;
      37           0 :   }
      38         806 :   fd_stake_delegations_iter_advance_disk_root_private( iter );
      39         806 : }
      40             : 
      41             : FD_PROTOTYPES_END
      42             : 
      43             : #endif /* HEADER_fd_src_flamenco_stakes_fd_stake_delegations_private_h */

Generated by: LCOV version 1.14