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>
This commit is contained in:
Rusty Russell 2018-06-22 09:24:57 +09:30 committed by Christian Decker
parent 9fa738a741
commit 8e571ba688
3 changed files with 9 additions and 4 deletions

View file

@ -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++) {
n = get_node(daemon->rstate, &ids[i]);
if (n)
/* FIXME: Keep global features from node_announcement! */
append_node(&nodes, &ids[i], NULL, NULL, n);
append_node(&nodes, &ids[i], n->gfeatures,
NULL, n);
}
} else {
struct node_map_iter i;
n = node_map_first(daemon->rstate->nodes, &i);
while (n != NULL) {
/* FIXME: Keep global features from node_announcement! */
append_node(&nodes, &n->id, NULL, NULL, n);
append_node(&nodes, &n->id, n->gfeatures, NULL, n);
n = node_map_next(daemon->rstate->nodes, &i);
}
}

View file

@ -148,6 +148,7 @@ static struct node *new_node(struct routing_state *rstate,
n->id = *id;
n->chans = tal_arr(n, struct chan *, 0);
n->alias = NULL;
n->gfeatures = NULL;
n->node_announcement = NULL;
n->node_announcement_index = 0;
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);
tal_free(node->alias);
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);
node->node_announcement = tal_dup_arr(node, u8, msg, tal_len(msg), 0);

View file

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