mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 10:46:58 +01:00
gossip_store: Save local_add_channel messages and replay them
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
7497f972f1
commit
64fbea1528
7 changed files with 42 additions and 0 deletions
|
@ -806,6 +806,8 @@ static struct io_plan *owner_msg_in(struct io_conn *conn,
|
|||
} else if (type == WIRE_GOSSIP_GET_UPDATE) {
|
||||
handle_get_update(peer, dc->msg_in);
|
||||
} else if (type == WIRE_GOSSIP_LOCAL_ADD_CHANNEL) {
|
||||
gossip_store_local_add_channel(peer->daemon->rstate->store,
|
||||
dc->msg_in);
|
||||
handle_local_add_channel(peer->daemon->rstate, dc->msg_in);
|
||||
} else {
|
||||
status_broken("peer %s: send us unknown msg of type %s",
|
||||
|
|
|
@ -109,6 +109,15 @@ void gossip_store_add_channel_delete(struct gossip_store *gs,
|
|||
tal_free(msg);
|
||||
}
|
||||
|
||||
void gossip_store_local_add_channel(struct gossip_store *gs,
|
||||
const u8 *add_msg)
|
||||
{
|
||||
u8 *msg = towire_gossip_store_local_add_channel(NULL, add_msg);
|
||||
gossip_store_append(gs, msg);
|
||||
tal_free(msg);
|
||||
}
|
||||
|
||||
|
||||
void gossip_store_load(struct routing_state *rstate, struct gossip_store *gs)
|
||||
{
|
||||
beint32_t belen;
|
||||
|
@ -163,6 +172,9 @@ void gossip_store_load(struct routing_state *rstate, struct gossip_store *gs)
|
|||
}
|
||||
tal_free(c);
|
||||
stats[3]++;
|
||||
} else if (fromwire_gossip_store_local_add_channel(
|
||||
msg, msg, &gossip_msg)) {
|
||||
handle_local_add_channel(rstate, gossip_msg);
|
||||
} else {
|
||||
bad = "Unknown message";
|
||||
goto truncate;
|
||||
|
|
|
@ -14,3 +14,7 @@ gossip_store_node_announcement,,announcement,len*u8
|
|||
|
||||
gossip_store_channel_delete,4099
|
||||
gossip_store_channel_delete,,short_channel_id,struct short_channel_id
|
||||
|
||||
gossip_store_local_add_channel,4100
|
||||
gossip_store_local_add_channel,,len,u16
|
||||
gossip_store_local_add_channel,,local_add,len*u8
|
|
|
@ -30,6 +30,12 @@ void gossip_store_load(struct routing_state *rstate, struct gossip_store *gs);
|
|||
void gossip_store_add_channel_announcement(struct gossip_store *gs,
|
||||
const u8 *gossip_msg, u64 satoshis);
|
||||
|
||||
/**
|
||||
* Store a local_add_channel so we remember it when restarting
|
||||
*/
|
||||
void gossip_store_local_add_channel(struct gossip_store *gs,
|
||||
const u8 *add_msg);
|
||||
|
||||
/**
|
||||
* Store a channel_update with its associated data in the gossip_store
|
||||
*/
|
||||
|
|
|
@ -74,6 +74,9 @@ bool fromwire_gossip_store_channel_delete(const void *p UNNEEDED, struct short_c
|
|||
/* 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_local_add_channel */
|
||||
bool fromwire_gossip_store_local_add_channel(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **local_add UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossip_store_local_add_channel 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(); }
|
||||
|
@ -117,6 +120,9 @@ u8 *towire_gossip_store_channel_delete(const tal_t *ctx UNNEEDED, const struct s
|
|||
/* 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_local_add_channel */
|
||||
u8 *towire_gossip_store_local_add_channel(const tal_t *ctx UNNEEDED, const u8 *local_add UNNEEDED)
|
||||
{ fprintf(stderr, "towire_gossip_store_local_add_channel 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(); }
|
||||
|
|
|
@ -38,6 +38,9 @@ bool fromwire_gossip_store_channel_delete(const void *p UNNEEDED, struct short_c
|
|||
/* 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_local_add_channel */
|
||||
bool fromwire_gossip_store_local_add_channel(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **local_add UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossip_store_local_add_channel 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(); }
|
||||
|
@ -81,6 +84,9 @@ u8 *towire_gossip_store_channel_delete(const tal_t *ctx UNNEEDED, const struct s
|
|||
/* 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_local_add_channel */
|
||||
u8 *towire_gossip_store_local_add_channel(const tal_t *ctx UNNEEDED, const u8 *local_add UNNEEDED)
|
||||
{ fprintf(stderr, "towire_gossip_store_local_add_channel 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(); }
|
||||
|
|
|
@ -36,6 +36,9 @@ bool fromwire_gossip_store_channel_delete(const void *p UNNEEDED, struct short_c
|
|||
/* 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_local_add_channel */
|
||||
bool fromwire_gossip_store_local_add_channel(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **local_add UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossip_store_local_add_channel 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(); }
|
||||
|
@ -79,6 +82,9 @@ u8 *towire_gossip_store_channel_delete(const tal_t *ctx UNNEEDED, const struct s
|
|||
/* 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_local_add_channel */
|
||||
u8 *towire_gossip_store_local_add_channel(const tal_t *ctx UNNEEDED, const u8 *local_add UNNEEDED)
|
||||
{ fprintf(stderr, "towire_gossip_store_local_add_channel 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(); }
|
||||
|
|
Loading…
Add table
Reference in a new issue