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