LCOV - code coverage report
Current view: top level - app/firedancer-dev/commands - gossip_dump.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 33 0.0 %
Date: 2025-10-14 04:31:44 Functions: 0 1 0.0 %

          Line data    Source code
       1             : #include "../../shared/fd_config.h"
       2             : #include "../../shared/fd_action.h"
       3             : #include "../../../discof/gossip/fd_gossip_tile.h"
       4             : #include "../../../util/net/fd_ip4.h"
       5             : 
       6             : #include <stdio.h>
       7             : 
       8             : void
       9             : gossip_dump_cmd_fn( args_t *   args,
      10           0 :                     config_t * config ) {
      11           0 :   (void)args;
      12             : 
      13           0 :   fd_topo_t * topo = &config->topo;
      14             : 
      15           0 :   ulong tile_id = fd_topo_find_tile( topo, "gossip", 0UL );
      16           0 :   if( FD_UNLIKELY( tile_id==ULONG_MAX ) ) {
      17           0 :     FD_LOG_ERR(( "gossip tile not found" ));
      18           0 :   }
      19           0 :   fd_topo_tile_t * tile = &topo->tiles[ tile_id ];
      20           0 :   ulong tile_obj_id = tile->tile_obj_id;
      21           0 :   FD_TEST( tile_obj_id!=ULONG_MAX );
      22           0 :   ulong wksp_id = topo->objs[ tile_obj_id ].wksp_id;
      23           0 :   FD_TEST( wksp_id!=ULONG_MAX );
      24           0 :   fd_topo_wksp_t * wksp = &topo->workspaces[ wksp_id ];
      25             : 
      26           0 :   fd_topo_join_workspace( topo, wksp, FD_SHMEM_JOIN_MODE_READ_ONLY );
      27             : 
      28           0 :   fd_gossip_tile_ctx_t * ctx = fd_topo_obj_laddr( topo, tile_obj_id );
      29             : 
      30           0 :   fd_contact_info_t my_ci[1];
      31           0 :   *my_ci = FD_VOLATILE_CONST( *ctx->my_contact_info );
      32             : 
      33           0 :   puts( "" );
      34           0 :   puts( "my_contact_info:" );
      35           0 :   FD_BASE58_ENCODE_32_BYTES( my_ci->pubkey.uc, pubkey_b58 );
      36           0 :   printf( "  pubkey: %s\n", pubkey_b58 );
      37           0 :   printf( "  shred_version: %u\n", my_ci->shred_version );
      38           0 :   puts( "  sockets:" );
      39           0 :   for( uint i=0UL; i<FD_CONTACT_INFO_SOCKET_CNT; i++ ) {
      40           0 :     fd_ip4_port_t const * ele = &my_ci->sockets[ i ];
      41           0 :     if( ele->addr==0 && ele->port==0 ) continue;
      42           0 :     printf( "    proto_%02u: " FD_IP4_ADDR_FMT ":%hu\n",
      43           0 :             i,
      44           0 :             FD_IP4_ADDR_FMT_ARGS( ele->addr ),
      45           0 :             fd_ushort_bswap( ele->port ) );
      46           0 :   }
      47           0 :   puts( "" );
      48             : 
      49             :   /* TODO dump further information */
      50           0 : }
      51             : 
      52             : action_t fd_action_gossip_dump = {
      53             :   .name           = "gossip-dump",
      54             :   .args           = NULL,
      55             :   .fn             = gossip_dump_cmd_fn,
      56             :   .require_config = 1,
      57             :   .perm           = NULL,
      58             :   .description    = "Dump gossip tile state",
      59             : };

Generated by: LCOV version 1.14