mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
gossip: Wrap node_announcements in gossip_store messages
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
db13c7e851
commit
3826518bd6
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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. */
|
||||
|
@ -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;
|
||||
|
@ -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…
Reference in New Issue
Block a user