Browse Source

gossip: Remember which broadcast index the node_announcement had

Avoids searching for it in the uintmap.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
35b44d5294
  1. 4
      gossipd/routing.c
  2. 3
      gossipd/routing.h

4
gossipd/routing.c

@ -130,6 +130,7 @@ static struct node *new_node(struct routing_state *rstate,
n->out = tal_arr(n, struct node_connection *, 0);
n->alias = NULL;
n->node_announcement = NULL;
n->announcement_idx = 0;
n->last_timestamp = -1;
n->addresses = tal_arr(n, struct wireaddr, 0);
node_map_add(rstate->nodes, n);
@ -1038,7 +1039,8 @@ void handle_node_announcement(
u8 *tag = tal_arr(tmpctx, u8, 0);
towire_pubkey(&tag, &node_id);
queue_broadcast(rstate->broadcasts,
replace_broadcast(rstate->broadcasts,
&node->announcement_idx,
WIRE_NODE_ANNOUNCEMENT,
tag,
serialized);

3
gossipd/routing.h

@ -74,6 +74,9 @@ struct node {
/* Cached `node_announcement` we might forward to new peers. */
u8 *node_announcement;
/* What index does the announcement broadcast have? */
u64 announcement_idx;
};
const secp256k1_pubkey *node_map_keyof_node(const struct node *n);

Loading…
Cancel
Save