Browse Source

gossip: Wrap node_announcements in gossip_store messages

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
3826518bd6
  1. 13
      gossipd/gossip_store.c
  2. 6
      gossipd/gossip_store.h
  3. 2
      gossipd/routing.c
  4. 6
      gossipd/test/run-bench-find_route.c
  5. 6
      gossipd/test/run-find_route-specific.c
  6. 6
      gossipd/test/run-find_route.c

13
gossipd/gossip_store.c

@ -74,6 +74,14 @@ void gossip_store_add_channel_update(struct gossip_store *gs,
tal_free(msg);
}
void gossip_store_add_node_announcement(struct gossip_store *gs,
const u8 *gossip_msg)
{
u8 *msg = towire_gossip_store_node_announcement(NULL, gossip_msg);
gossip_store_append(gs, msg);
tal_free(msg);
}
const u8 *gossip_store_read_next(const tal_t *ctx, struct routing_state *rstate,
struct gossip_store *gs)
{
@ -121,7 +129,10 @@ const u8 *gossip_store_read_next(const tal_t *ctx, struct routing_state *rstate,
fromwire_gossip_store_channel_update(msg, msg, &gossip_msg);
routing_add_channel_update(rstate, gossip_msg);
return gossip_msg;
} else if(type == WIRE_GOSSIP_STORE_NODE_ANNOUNCEMENT) {
fromwire_gossip_store_node_announcement(msg, msg, &gossip_msg);
routing_add_node_announcement(rstate, gossip_msg);
return gossip_msg;
}
return msg;
}

6
gossipd/gossip_store.h

@ -47,4 +47,10 @@ void gossip_store_add_channel_announcement(struct gossip_store *gs,
void gossip_store_add_channel_update(struct gossip_store *gs,
const u8 *gossip_msg);
/**
* Store a node_announcement with its associated data in the gossip_store
*/
void gossip_store_add_node_announcement(struct gossip_store *gs,
const u8 *gossip_msg);
#endif /* GOSSIPD_GOSSIP_STORE_H */

2
gossipd/routing.c

@ -1227,7 +1227,7 @@ u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann,
/* FIXME: remove store guard */
if (store)
gossip_store_append(rstate->store, serialized);
gossip_store_add_node_announcement(rstate->store, serialized);
routing_add_node_announcement(rstate, serialized);
return NULL;
}

6
gossipd/test/run-bench-find_route.c

@ -68,6 +68,9 @@ bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const
/* Generated stub for fromwire_gossip_store_channel_update */
bool fromwire_gossip_store_channel_update(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **update UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_store_channel_update called!\n"); abort(); }
/* Generated stub for fromwire_gossip_store_node_announcement */
bool fromwire_gossip_store_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_store_node_announcement called!\n"); abort(); }
/* Generated stub for fromwire_node_announcement */
bool fromwire_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, u8 **features UNNEEDED, u32 *timestamp UNNEEDED, struct pubkey *node_id UNNEEDED, u8 rgb_color[3] UNNEEDED, u8 alias[32] UNNEEDED, u8 **addresses UNNEEDED)
{ fprintf(stderr, "fromwire_node_announcement called!\n"); abort(); }
@ -108,6 +111,9 @@ u8 *towire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const u8
/* Generated stub for towire_gossip_store_channel_update */
u8 *towire_gossip_store_channel_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
{ fprintf(stderr, "towire_gossip_store_channel_update called!\n"); abort(); }
/* Generated stub for towire_gossip_store_node_announcement */
u8 *towire_gossip_store_node_announcement(const tal_t *ctx UNNEEDED, const u8 *announcement UNNEEDED)
{ fprintf(stderr, "towire_gossip_store_node_announcement called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
/* Updates existing route if required. */

6
gossipd/test/run-find_route-specific.c

@ -32,6 +32,9 @@ bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const
/* Generated stub for fromwire_gossip_store_channel_update */
bool fromwire_gossip_store_channel_update(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **update UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_store_channel_update called!\n"); abort(); }
/* Generated stub for fromwire_gossip_store_node_announcement */
bool fromwire_gossip_store_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_store_node_announcement called!\n"); abort(); }
/* Generated stub for fromwire_node_announcement */
bool fromwire_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, u8 **features UNNEEDED, u32 *timestamp UNNEEDED, struct pubkey *node_id UNNEEDED, u8 rgb_color[3] UNNEEDED, u8 alias[32] UNNEEDED, u8 **addresses UNNEEDED)
{ fprintf(stderr, "fromwire_node_announcement called!\n"); abort(); }
@ -72,6 +75,9 @@ u8 *towire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const u8
/* Generated stub for towire_gossip_store_channel_update */
u8 *towire_gossip_store_channel_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
{ fprintf(stderr, "towire_gossip_store_channel_update called!\n"); abort(); }
/* Generated stub for towire_gossip_store_node_announcement */
u8 *towire_gossip_store_node_announcement(const tal_t *ctx UNNEEDED, const u8 *announcement UNNEEDED)
{ fprintf(stderr, "towire_gossip_store_node_announcement called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
const void *trc;

6
gossipd/test/run-find_route.c

@ -30,6 +30,9 @@ bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const
/* Generated stub for fromwire_gossip_store_channel_update */
bool fromwire_gossip_store_channel_update(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **update UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_store_channel_update called!\n"); abort(); }
/* Generated stub for fromwire_gossip_store_node_announcement */
bool fromwire_gossip_store_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_store_node_announcement called!\n"); abort(); }
/* Generated stub for fromwire_node_announcement */
bool fromwire_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, u8 **features UNNEEDED, u32 *timestamp UNNEEDED, struct pubkey *node_id UNNEEDED, u8 rgb_color[3] UNNEEDED, u8 alias[32] UNNEEDED, u8 **addresses UNNEEDED)
{ fprintf(stderr, "fromwire_node_announcement called!\n"); abort(); }
@ -70,6 +73,9 @@ u8 *towire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const u8
/* Generated stub for towire_gossip_store_channel_update */
u8 *towire_gossip_store_channel_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
{ fprintf(stderr, "towire_gossip_store_channel_update called!\n"); abort(); }
/* Generated stub for towire_gossip_store_node_announcement */
u8 *towire_gossip_store_node_announcement(const tal_t *ctx UNNEEDED, const u8 *announcement UNNEEDED)
{ fprintf(stderr, "towire_gossip_store_node_announcement called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
/* Updates existing route if required. */

Loading…
Cancel
Save