Browse Source

listnodes: expose global features.

Since nobody sets these yet, it's a bit moot, but it will be great in
future.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
8e571ba688
  1. 7
      gossipd/gossip.c
  2. 3
      gossipd/routing.c
  3. 3
      gossipd/routing.h

7
gossipd/gossip.c

@ -2146,15 +2146,14 @@ static struct io_plan *getnodes(struct io_conn *conn, struct daemon *daemon,
for (size_t i = 0; i < tal_count(ids); i++) { for (size_t i = 0; i < tal_count(ids); i++) {
n = get_node(daemon->rstate, &ids[i]); n = get_node(daemon->rstate, &ids[i]);
if (n) if (n)
/* FIXME: Keep global features from node_announcement! */ append_node(&nodes, &ids[i], n->gfeatures,
append_node(&nodes, &ids[i], NULL, NULL, n); NULL, n);
} }
} else { } else {
struct node_map_iter i; struct node_map_iter i;
n = node_map_first(daemon->rstate->nodes, &i); n = node_map_first(daemon->rstate->nodes, &i);
while (n != NULL) { while (n != NULL) {
/* FIXME: Keep global features from node_announcement! */ append_node(&nodes, &n->id, n->gfeatures, NULL, n);
append_node(&nodes, &n->id, NULL, NULL, n);
n = node_map_next(daemon->rstate->nodes, &i); n = node_map_next(daemon->rstate->nodes, &i);
} }
} }

3
gossipd/routing.c

@ -148,6 +148,7 @@ static struct node *new_node(struct routing_state *rstate,
n->id = *id; n->id = *id;
n->chans = tal_arr(n, struct chan *, 0); n->chans = tal_arr(n, struct chan *, 0);
n->alias = NULL; n->alias = NULL;
n->gfeatures = NULL;
n->node_announcement = NULL; n->node_announcement = NULL;
n->node_announcement_index = 0; n->node_announcement_index = 0;
n->last_timestamp = -1; n->last_timestamp = -1;
@ -1287,6 +1288,8 @@ bool routing_add_node_announcement(struct routing_state *rstate, const u8 *msg T
memcpy(node->rgb_color, rgb_color, 3); memcpy(node->rgb_color, rgb_color, 3);
tal_free(node->alias); tal_free(node->alias);
node->alias = tal_dup_arr(node, u8, alias, 32, 0); node->alias = tal_dup_arr(node, u8, alias, 32, 0);
tal_free(node->gfeatures);
node->gfeatures = tal_steal(node, features);
tal_free(node->node_announcement); tal_free(node->node_announcement);
node->node_announcement = tal_dup_arr(node, u8, msg, tal_len(msg), 0); node->node_announcement = tal_dup_arr(node, u8, msg, tal_len(msg), 0);

3
gossipd/routing.h

@ -101,6 +101,9 @@ struct node {
/* Color to be used when displaying the name */ /* Color to be used when displaying the name */
u8 rgb_color[3]; u8 rgb_color[3];
/* (Global) features */
u8 *gfeatures;
/* Cached `node_announcement` we might forward to new peers (or NULL). */ /* Cached `node_announcement` we might forward to new peers (or NULL). */
const u8 *node_announcement; const u8 *node_announcement;
/* If public, this is non-zero. */ /* If public, this is non-zero. */

Loading…
Cancel
Save