mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
gossip: Wrap channel_updates in the gossip_store as well
Bypasses verification when loading from the gossip_store. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
6e01f38d7d
commit
db13c7e851
6 changed files with 40 additions and 2 deletions
|
@ -66,6 +66,14 @@ void gossip_store_add_channel_announcement(struct gossip_store *gs, const u8 *go
|
|||
tal_free(msg);
|
||||
}
|
||||
|
||||
void gossip_store_add_channel_update(struct gossip_store *gs,
|
||||
const u8 *gossip_msg)
|
||||
{
|
||||
u8 *msg = towire_gossip_store_channel_update(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)
|
||||
{
|
||||
|
@ -109,6 +117,10 @@ const u8 *gossip_store_read_next(const tal_t *ctx, struct routing_state *rstate,
|
|||
|
||||
/* No harm in returning it, it'll get discarded as a duplicate */
|
||||
return gossip_msg;
|
||||
} else if(type == WIRE_GOSSIP_STORE_CHANNEL_UPDATE) {
|
||||
fromwire_gossip_store_channel_update(msg, msg, &gossip_msg);
|
||||
routing_add_channel_update(rstate, gossip_msg);
|
||||
return gossip_msg;
|
||||
}
|
||||
|
||||
return msg;
|
||||
|
|
|
@ -40,4 +40,11 @@ const u8 *gossip_store_read_next(const tal_t *ctx, struct routing_state *rstate,
|
|||
*/
|
||||
void gossip_store_add_channel_announcement(struct gossip_store *gs,
|
||||
const u8 *gossip_msg, u64 satoshis);
|
||||
|
||||
/**
|
||||
* Store a channel_update with its associated data in the gossip_store
|
||||
*/
|
||||
void gossip_store_add_channel_update(struct gossip_store *gs,
|
||||
const u8 *gossip_msg);
|
||||
|
||||
#endif /* GOSSIPD_GOSSIP_STORE_H */
|
||||
|
|
|
@ -1029,8 +1029,9 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update,
|
|||
flags & 0x01,
|
||||
flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE");
|
||||
|
||||
if (store)
|
||||
gossip_store_append(rstate->store, serialized);
|
||||
/* Only store updates for public channels */
|
||||
if (chan->public)
|
||||
gossip_store_add_channel_update(rstate->store, serialized);
|
||||
routing_add_channel_update(rstate, serialized);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,9 @@ bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *
|
|||
/* Generated stub for fromwire_gossip_store_channel_announcement */
|
||||
bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED, u64 *satoshis UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); }
|
||||
/* 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_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(); }
|
||||
|
@ -102,6 +105,9 @@ u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
|
|||
/* Generated stub for towire_gossip_store_channel_announcement */
|
||||
u8 *towire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const u8 *announcement UNNEEDED, u64 satoshis UNNEEDED)
|
||||
{ fprintf(stderr, "towire_gossip_store_channel_announcement called!\n"); abort(); }
|
||||
/* 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(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
/* Updates existing route if required. */
|
||||
|
|
|
@ -29,6 +29,9 @@ bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *
|
|||
/* Generated stub for fromwire_gossip_store_channel_announcement */
|
||||
bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED, u64 *satoshis UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); }
|
||||
/* 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_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(); }
|
||||
|
@ -66,6 +69,9 @@ u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
|
|||
/* Generated stub for towire_gossip_store_channel_announcement */
|
||||
u8 *towire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const u8 *announcement UNNEEDED, u64 satoshis UNNEEDED)
|
||||
{ fprintf(stderr, "towire_gossip_store_channel_announcement called!\n"); abort(); }
|
||||
/* 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(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
const void *trc;
|
||||
|
|
|
@ -27,6 +27,9 @@ bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *
|
|||
/* Generated stub for fromwire_gossip_store_channel_announcement */
|
||||
bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED, u64 *satoshis UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); }
|
||||
/* 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_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(); }
|
||||
|
@ -64,6 +67,9 @@ u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
|
|||
/* Generated stub for towire_gossip_store_channel_announcement */
|
||||
u8 *towire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const u8 *announcement UNNEEDED, u64 satoshis UNNEEDED)
|
||||
{ fprintf(stderr, "towire_gossip_store_channel_announcement called!\n"); abort(); }
|
||||
/* 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(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
/* Updates existing route if required. */
|
||||
|
|
Loading…
Add table
Reference in a new issue