Browse Source

gossip: Added uintmap based channels map, indexed by scids

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

2
gossipd/routing.c

@ -68,6 +68,8 @@ struct routing_state *new_routing_state(const tal_t *ctx,
rstate->chain_hash = *chain_hash;
rstate->local_id = *local_id;
list_head_init(&rstate->pending_cannouncement);
uintmap_init(&rstate->channels);
return rstate;
}

18
gossipd/routing.h

@ -81,6 +81,21 @@ size_t node_map_hash_key(const secp256k1_pubkey *key);
bool node_map_node_eq(const struct node *n, const secp256k1_pubkey *key);
HTABLE_DEFINE_TYPE(struct node, node_map_keyof_node, node_map_hash_key, node_map_node_eq, node_map);
enum txout_state {
TXOUT_FETCHING,
TXOUT_PRESENT,
TXOUT_MISSING
};
struct routing_channel {
struct short_channel_id scid;
enum txout_state state;
u8 *txout_script;
struct node_connection *connections[2];
struct node *nodes[2];
};
struct routing_state {
/* All known nodes. */
struct node_map *nodes;
@ -94,6 +109,9 @@ struct routing_state {
/* Our own ID so we can identify local channels */
struct pubkey local_id;
/* A map of channels indexed by short_channel_ids */
UINTMAP(struct routing_channel*) channels;
};
struct route_hop {

Loading…
Cancel
Save