LCOV - code coverage report
Current view: top level - flamenco/features - fd_features.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 41 41 100.0 %
Date: 2024-11-13 11:58:15 Functions: 4 4 100.0 %

          Line data    Source code
       1             : #include "fd_features.h"
       2             : 
       3             : void
       4           3 : fd_features_enable_all( fd_features_t * f ) {
       5           3 :   for( fd_feature_id_t const * id = fd_feature_iter_init();
       6         612 :        !fd_feature_iter_done( id );
       7         609 :        id = fd_feature_iter_next( id ) ) {
       8         609 :     fd_features_set( f, id, 0UL );
       9         609 :   }
      10           3 : }
      11             : 
      12             : void
      13      221982 : fd_features_disable_all( fd_features_t * f ) {
      14      221982 :   for( fd_feature_id_t const * id = fd_feature_iter_init();
      15    45284328 :        !fd_feature_iter_done( id );
      16    45062346 :        id = fd_feature_iter_next( id ) ) {
      17    45062346 :     fd_features_set( f, id, FD_FEATURE_DISABLED );
      18    45062346 :   }
      19      221982 : }
      20             : 
      21             : void
      22      108786 : fd_features_enable_cleaned_up( fd_features_t * f, uint cluster_version[3] ) {
      23      108786 :   for( fd_feature_id_t const * id = fd_feature_iter_init();
      24    22192344 :        !fd_feature_iter_done( id );
      25    22083558 :        id = fd_feature_iter_next( id ) ) {
      26    22083558 :     if( ( id->cleaned_up[0]<cluster_version[0] ) ||
      27    22083558 :         ( id->cleaned_up[0]==cluster_version[0] && id->cleaned_up[1]<cluster_version[1] ) ||
      28    22083558 :         ( id->cleaned_up[0]==cluster_version[0] && id->cleaned_up[1]==cluster_version[1] && id->cleaned_up[2]<=cluster_version[2] ) ) {
      29    13707036 :       fd_features_set( f, id, 0UL );
      30    13707036 :     } else {
      31     8376522 :       fd_features_set( f, id, FD_FEATURE_DISABLED );
      32     8376522 :     }
      33    22083558 :   }
      34      108786 : }
      35             : 
      36             : void
      37          18 : fd_features_enable_one_offs( fd_features_t * f, char const * * one_offs, uint one_offs_cnt, ulong slot ) {
      38          18 :   uchar pubkey[32];
      39          36 :   for( uint i=0U; i<one_offs_cnt; i++ ) {
      40          18 :     fd_base58_decode_32( one_offs[i], pubkey );
      41          18 :     for( fd_feature_id_t const * id = fd_feature_iter_init();
      42        2664 :          !fd_feature_iter_done( id );
      43        2664 :          id = fd_feature_iter_next( id ) ) {
      44        2664 :       if( !memcmp( &id->id, pubkey, sizeof(fd_pubkey_t) ) ) {
      45          18 :         fd_features_set( f, id, slot );
      46          18 :         break;
      47          18 :       }
      48        2664 :     }
      49          18 :   }
      50          18 : }

Generated by: LCOV version 1.14