gossipd: use htable_count() rather than reaching into htable struct.
Now ccan/htable provides the helper, let's use it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
39b34a35c8
commit
2f1e116510
|
@ -2677,13 +2677,13 @@ static struct io_plan *getnodes(struct io_conn *conn, struct daemon *daemon,
|
|||
struct node_map_iter it;
|
||||
size_t i = 0;
|
||||
node_arr = tal_arr(tmpctx, struct gossip_getnodes_entry,
|
||||
daemon->rstate->nodes->raw.elems);
|
||||
node_map_count(daemon->rstate->nodes));
|
||||
n = node_map_first(daemon->rstate->nodes, &it);
|
||||
while (n != NULL) {
|
||||
add_node_entry(node_arr, daemon, n, &node_arr[i++]);
|
||||
n = node_map_next(daemon->rstate->nodes, &it);
|
||||
}
|
||||
assert(i == daemon->rstate->nodes->raw.elems);
|
||||
assert(i == node_map_count(daemon->rstate->nodes));
|
||||
}
|
||||
|
||||
/* FIXME: towire wants array of pointers. */
|
||||
|
|
|
@ -320,8 +320,7 @@ static void remove_chan_from_node(struct routing_state *rstate,
|
|||
} else {
|
||||
if (!chan_map_del(&node->chans.map, chan))
|
||||
abort();
|
||||
/* FIXME: Expose this in ccan/htable */
|
||||
num_chans = node->chans.map.raw.elems;
|
||||
num_chans = chan_map_count(&node->chans.map);
|
||||
}
|
||||
|
||||
/* Last channel? Simply delete node (and associated announce) */
|
||||
|
|
Loading…
Reference in New Issue