diff --git a/daemon/irc_announce.c b/daemon/irc_announce.c index 4b6a55061..f45dac401 100644 --- a/daemon/irc_announce.c +++ b/daemon/irc_announce.c @@ -177,9 +177,7 @@ static void handle_irc_node_announcement( char **splits) { struct pubkey *pk = talz(msg, struct pubkey); - char *hostname = tal_strdup(msg, splits[2]); - int port = atoi(splits[3]); - if (!pubkey_from_hexstr(splits[1], strlen(splits[1]), pk) || port < 1) + if (!pubkey_from_hexstr(splits[1], strlen(splits[1]), pk)) return; if (!verify_signed_privmsg(istate, pk, msg)) { @@ -191,7 +189,7 @@ static void handle_irc_node_announcement( splits[1]); } - struct node *node = add_node(istate->dstate->rstate, pk, hostname, port); + struct node *node = add_node(istate->dstate->rstate, pk); if (splits[4] != NULL){ tal_free(node->alias); node->alias = tal_hexdata(node, splits[4], strlen(splits[4])); @@ -233,8 +231,7 @@ static void handle_irc_command(struct ircstate *istate, const struct irccommand log_debug(dstate->base_log, "Detected my own IP as %s", dstate->external_ip); // Add our node to the node_map for completeness - add_node(istate->dstate->rstate, &dstate->id, - dstate->external_ip, dstate->portnum); + add_node(istate->dstate->rstate, &dstate->id); } else if (streq(cmd->command, "JOIN")) { unsigned int delay; diff --git a/daemon/routing.c b/daemon/routing.c index 380de8898..428b010dd 100644 --- a/daemon/routing.c +++ b/daemon/routing.c @@ -74,9 +74,7 @@ struct node *new_node(struct routing_state *rstate, n->id = *id; n->in = tal_arr(n, struct node_connection *, 0); n->out = tal_arr(n, struct node_connection *, 0); - n->port = 0; n->alias = NULL; - n->hostname = NULL; n->node_announcement = NULL; n->last_timestamp = 0; n->addresses = tal_arr(n, struct ipaddr, 0); @@ -88,9 +86,7 @@ struct node *new_node(struct routing_state *rstate, struct node *add_node( struct routing_state *rstate, - const struct pubkey *pk, - char *hostname, - int port) + const struct pubkey *pk) { struct node *n = get_node(rstate, pk); if (!n) { @@ -101,8 +97,6 @@ struct node *add_node( log_debug_struct(rstate->base_log, "Update existing node %s", struct pubkey, pk); } - n->hostname = tal_steal(n, hostname); - n->port = port; return n; } @@ -916,13 +910,6 @@ void handle_node_announcement( node->addresses = tal_steal(node, ipaddrs); node->last_timestamp = timestamp; - node->hostname = tal_free(node->hostname); - - if (!read_ip(node, addresses, &node->hostname, &node->port)) { - /* FIXME: SHOULD fail connection here. */ - tal_free(serialized); - return; - } memcpy(node->rgb_color, rgb_color, 3); diff --git a/daemon/routing.h b/daemon/routing.h index 9732611a5..17b5df0b7 100644 --- a/daemon/routing.h +++ b/daemon/routing.h @@ -46,8 +46,6 @@ struct node { /* IP/Hostname and port of this node (may be NULL) */ struct ipaddr *addresses; - char *hostname; - int port; u32 last_timestamp; @@ -112,9 +110,7 @@ s64 connection_fee(const struct node_connection *c, u64 msatoshi); /* Updates existing node, or creates a new one as required. */ struct node *add_node(struct routing_state *rstate, - const struct pubkey *pk, - char *hostname, - int port); + const struct pubkey *pk); /* Updates existing connection, or creates new one as required. */ struct node_connection *add_connection(struct routing_state *rstate, diff --git a/daemon/routingrpc.c b/daemon/routingrpc.c index 3c8e7c115..182cf3dbb 100644 --- a/daemon/routingrpc.c +++ b/daemon/routingrpc.c @@ -136,6 +136,7 @@ static void json_getnodes(struct command *cmd, struct json_result *response = new_json_result(cmd); struct node *n; struct node_map_iter i; + size_t j; n = node_map_first(cmd->dstate->rstate->nodes, &i); @@ -145,12 +146,11 @@ static void json_getnodes(struct command *cmd, while (n != NULL) { json_object_start(response, NULL); json_add_pubkey(response, "nodeid", &n->id); - json_add_num(response, "port", n->port); - if (!n->port) - json_add_null(response, "hostname"); - else - json_add_string(response, "hostname", n->hostname); - + json_array_start(response, "addresses"); + for (j=0; jaddresses); j++) { + json_add_address(response, NULL, &n->addresses[j]); + } + json_array_end(response); json_object_end(response); n = node_map_next(cmd->dstate->rstate->nodes, &i); } diff --git a/lightningd/gossip/gossip.c b/lightningd/gossip/gossip.c index 80407db33..e290f0d12 100644 --- a/lightningd/gossip/gossip.c +++ b/lightningd/gossip/gossip.c @@ -570,8 +570,6 @@ static struct io_plan *getnodes(struct io_conn *conn, struct daemon *daemon) while (n != NULL) { tal_resize(&nodes, node_count + 1); nodes[node_count].nodeid = n->id; - nodes[node_count].hostname = n->hostname; - nodes[node_count].port = n->port; nodes[node_count].addresses = n->addresses; node_count++; n = node_map_next(daemon->rstate->nodes, &i); diff --git a/lightningd/gossip_msg.c b/lightningd/gossip_msg.c index f64cfe8a5..25d4a458a 100644 --- a/lightningd/gossip_msg.c +++ b/lightningd/gossip_msg.c @@ -3,7 +3,6 @@ void fromwire_gossip_getnodes_entry(const tal_t *ctx, const u8 **pptr, size_t *max, struct gossip_getnodes_entry *entry) { - u8 hostnamelen; u8 numaddresses, i; fromwire_pubkey(pptr, max, &entry->nodeid); numaddresses = fromwire_u8(pptr, max); @@ -12,15 +11,9 @@ void fromwire_gossip_getnodes_entry(const tal_t *ctx, const u8 **pptr, size_t *m for (i=0; iaddresses); } - - hostnamelen = fromwire_u8(pptr, max); - entry->hostname = tal_arr(ctx, char, hostnamelen); - fromwire_u8_array(pptr, max, (u8*)entry->hostname, hostnamelen); - entry->port = fromwire_u16(pptr, max); } void towire_gossip_getnodes_entry(u8 **pptr, const struct gossip_getnodes_entry *entry) { - u8 hostnamelen; u8 i, numaddresses = tal_count(entry->addresses); towire_pubkey(pptr, &entry->nodeid); towire_u8(pptr, numaddresses); @@ -28,17 +21,6 @@ void towire_gossip_getnodes_entry(u8 **pptr, const struct gossip_getnodes_entry for (i=0; iaddresses[i]); } - - if (entry->hostname) { - hostnamelen = strlen(entry->hostname); - towire_u8(pptr, hostnamelen); - towire_u8_array(pptr, (u8*)entry->hostname, hostnamelen); - }else { - /* If we don't have a hostname just write an empty string */ - hostnamelen = 0; - towire_u8(pptr, hostnamelen); - } - towire_u16(pptr, entry->port); } void fromwire_route_hop(const u8 **pptr, size_t *max, struct route_hop *entry) diff --git a/lightningd/gossip_msg.h b/lightningd/gossip_msg.h index 3bf10d277..638855595 100644 --- a/lightningd/gossip_msg.h +++ b/lightningd/gossip_msg.h @@ -7,8 +7,6 @@ struct gossip_getnodes_entry { struct pubkey nodeid; struct ipaddr *addresses; - char *hostname; - u16 port; }; struct gossip_getchannels_entry {