mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 09:40:19 +01:00
gossipd: add tombstone when we remove a channel.
For those following along at home. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
496c0dd1e6
commit
7dd6f8f2b5
10 changed files with 42 additions and 0 deletions
|
@ -619,6 +619,13 @@ void gossip_store_delete(struct gossip_store *gs,
|
||||||
WIRE_GOSSIP_STORE_CHANNEL_AMOUNT);
|
WIRE_GOSSIP_STORE_CHANNEL_AMOUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gossip_store_mark_channel_deleted(struct gossip_store *gs,
|
||||||
|
const struct short_channel_id *scid)
|
||||||
|
{
|
||||||
|
gossip_store_add(gs, towire_gossip_store_delete_chan(tmpctx, scid),
|
||||||
|
0, false, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
const u8 *gossip_store_get(const tal_t *ctx,
|
const u8 *gossip_store_get(const tal_t *ctx,
|
||||||
struct gossip_store *gs,
|
struct gossip_store *gs,
|
||||||
u64 offset)
|
u64 offset)
|
||||||
|
@ -783,6 +790,9 @@ u32 gossip_store_load(struct routing_state *rstate, struct gossip_store *gs)
|
||||||
goto badmsg;
|
goto badmsg;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WIRE_GOSSIP_STORE_DELETE_CHAN:
|
||||||
|
/* No need to copy these */
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
bad = "Unknown message";
|
bad = "Unknown message";
|
||||||
goto badmsg;
|
goto badmsg;
|
||||||
|
|
|
@ -55,6 +55,13 @@ void gossip_store_delete(struct gossip_store *gs,
|
||||||
struct broadcastable *bcast,
|
struct broadcastable *bcast,
|
||||||
int type);
|
int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark that the channel is about to be deleted, for convenience of
|
||||||
|
* others mapping the gossip_store.
|
||||||
|
*/
|
||||||
|
void gossip_store_mark_channel_deleted(struct gossip_store *gs,
|
||||||
|
const struct short_channel_id *scid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Direct store accessor: loads gossip msg back from store.
|
* Direct store accessor: loads gossip msg back from store.
|
||||||
*
|
*
|
||||||
|
|
|
@ -10,3 +10,7 @@ msgdata,gossip_store_channel_amount,satoshis,amount_sat,
|
||||||
msgtype,gossip_store_private_update,4102
|
msgtype,gossip_store_private_update,4102
|
||||||
msgdata,gossip_store_private_update,len,u16,
|
msgdata,gossip_store_private_update,len,u16,
|
||||||
msgdata,gossip_store_private_update,update,u8,len
|
msgdata,gossip_store_private_update,update,u8,len
|
||||||
|
|
||||||
|
msgtype,gossip_store_delete_chan,4103
|
||||||
|
msgdata,gossip_store_delete_chan,scid,short_channel_id,
|
||||||
|
|
||||||
|
|
|
|
@ -2261,6 +2261,7 @@ void remove_channel_from_store(struct routing_state *rstate,
|
||||||
if (is_chan_public(chan)) {
|
if (is_chan_public(chan)) {
|
||||||
update_type = WIRE_CHANNEL_UPDATE;
|
update_type = WIRE_CHANNEL_UPDATE;
|
||||||
announcment_type = WIRE_CHANNEL_ANNOUNCEMENT;
|
announcment_type = WIRE_CHANNEL_ANNOUNCEMENT;
|
||||||
|
gossip_store_mark_channel_deleted(rstate->gs, &chan->scid);
|
||||||
} else {
|
} else {
|
||||||
update_type = WIRE_GOSSIP_STORE_PRIVATE_UPDATE;
|
update_type = WIRE_GOSSIP_STORE_PRIVATE_UPDATE;
|
||||||
announcment_type = WIRE_GOSSIPD_LOCAL_ADD_CHANNEL;
|
announcment_type = WIRE_GOSSIPD_LOCAL_ADD_CHANNEL;
|
||||||
|
|
|
@ -101,6 +101,9 @@ u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
|
||||||
/* Generated stub for towire_gossip_store_channel_amount */
|
/* Generated stub for towire_gossip_store_channel_amount */
|
||||||
u8 *towire_gossip_store_channel_amount(const tal_t *ctx UNNEEDED, struct amount_sat satoshis UNNEEDED)
|
u8 *towire_gossip_store_channel_amount(const tal_t *ctx UNNEEDED, struct amount_sat satoshis UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossip_store_channel_amount called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossip_store_channel_amount called!\n"); abort(); }
|
||||||
|
/* Generated stub for towire_gossip_store_delete_chan */
|
||||||
|
u8 *towire_gossip_store_delete_chan(const tal_t *ctx UNNEEDED, const struct short_channel_id *scid UNNEEDED)
|
||||||
|
{ fprintf(stderr, "towire_gossip_store_delete_chan called!\n"); abort(); }
|
||||||
/* Generated stub for towire_gossip_store_private_update */
|
/* Generated stub for towire_gossip_store_private_update */
|
||||||
u8 *towire_gossip_store_private_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
|
u8 *towire_gossip_store_private_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossip_store_private_update called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossip_store_private_update called!\n"); abort(); }
|
||||||
|
|
|
@ -69,6 +69,10 @@ const u8 *gossip_store_get_private_update(const tal_t *ctx UNNEEDED,
|
||||||
struct gossip_store *gs UNNEEDED,
|
struct gossip_store *gs UNNEEDED,
|
||||||
u64 offset UNNEEDED)
|
u64 offset UNNEEDED)
|
||||||
{ fprintf(stderr, "gossip_store_get_private_update called!\n"); abort(); }
|
{ fprintf(stderr, "gossip_store_get_private_update called!\n"); abort(); }
|
||||||
|
/* Generated stub for gossip_store_mark_channel_deleted */
|
||||||
|
void gossip_store_mark_channel_deleted(struct gossip_store *gs UNNEEDED,
|
||||||
|
const struct short_channel_id *scid UNNEEDED)
|
||||||
|
{ fprintf(stderr, "gossip_store_mark_channel_deleted called!\n"); abort(); }
|
||||||
/* Generated stub for gossip_store_new */
|
/* Generated stub for gossip_store_new */
|
||||||
struct gossip_store *gossip_store_new(struct routing_state *rstate UNNEEDED,
|
struct gossip_store *gossip_store_new(struct routing_state *rstate UNNEEDED,
|
||||||
struct list_head *peers UNNEEDED)
|
struct list_head *peers UNNEEDED)
|
||||||
|
|
|
@ -88,6 +88,9 @@ u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
|
||||||
/* Generated stub for towire_gossip_store_channel_amount */
|
/* Generated stub for towire_gossip_store_channel_amount */
|
||||||
u8 *towire_gossip_store_channel_amount(const tal_t *ctx UNNEEDED, struct amount_sat satoshis UNNEEDED)
|
u8 *towire_gossip_store_channel_amount(const tal_t *ctx UNNEEDED, struct amount_sat satoshis UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossip_store_channel_amount called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossip_store_channel_amount called!\n"); abort(); }
|
||||||
|
/* Generated stub for towire_gossip_store_delete_chan */
|
||||||
|
u8 *towire_gossip_store_delete_chan(const tal_t *ctx UNNEEDED, const struct short_channel_id *scid UNNEEDED)
|
||||||
|
{ fprintf(stderr, "towire_gossip_store_delete_chan called!\n"); abort(); }
|
||||||
/* Generated stub for towire_gossip_store_private_update */
|
/* Generated stub for towire_gossip_store_private_update */
|
||||||
u8 *towire_gossip_store_private_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
|
u8 *towire_gossip_store_private_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossip_store_private_update called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossip_store_private_update called!\n"); abort(); }
|
||||||
|
|
|
@ -88,6 +88,9 @@ u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
|
||||||
/* Generated stub for towire_gossip_store_channel_amount */
|
/* Generated stub for towire_gossip_store_channel_amount */
|
||||||
u8 *towire_gossip_store_channel_amount(const tal_t *ctx UNNEEDED, struct amount_sat satoshis UNNEEDED)
|
u8 *towire_gossip_store_channel_amount(const tal_t *ctx UNNEEDED, struct amount_sat satoshis UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossip_store_channel_amount called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossip_store_channel_amount called!\n"); abort(); }
|
||||||
|
/* Generated stub for towire_gossip_store_delete_chan */
|
||||||
|
u8 *towire_gossip_store_delete_chan(const tal_t *ctx UNNEEDED, const struct short_channel_id *scid UNNEEDED)
|
||||||
|
{ fprintf(stderr, "towire_gossip_store_delete_chan called!\n"); abort(); }
|
||||||
/* Generated stub for towire_gossip_store_private_update */
|
/* Generated stub for towire_gossip_store_private_update */
|
||||||
u8 *towire_gossip_store_private_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
|
u8 *towire_gossip_store_private_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossip_store_private_update called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossip_store_private_update called!\n"); abort(); }
|
||||||
|
|
|
@ -88,6 +88,9 @@ u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
|
||||||
/* Generated stub for towire_gossip_store_channel_amount */
|
/* Generated stub for towire_gossip_store_channel_amount */
|
||||||
u8 *towire_gossip_store_channel_amount(const tal_t *ctx UNNEEDED, struct amount_sat satoshis UNNEEDED)
|
u8 *towire_gossip_store_channel_amount(const tal_t *ctx UNNEEDED, struct amount_sat satoshis UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossip_store_channel_amount called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossip_store_channel_amount called!\n"); abort(); }
|
||||||
|
/* Generated stub for towire_gossip_store_delete_chan */
|
||||||
|
u8 *towire_gossip_store_delete_chan(const tal_t *ctx UNNEEDED, const struct short_channel_id *scid UNNEEDED)
|
||||||
|
{ fprintf(stderr, "towire_gossip_store_delete_chan called!\n"); abort(); }
|
||||||
/* Generated stub for towire_gossip_store_private_update */
|
/* Generated stub for towire_gossip_store_private_update */
|
||||||
u8 *towire_gossip_store_private_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
|
u8 *towire_gossip_store_private_update(const tal_t *ctx UNNEEDED, const u8 *update UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossip_store_private_update called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossip_store_private_update called!\n"); abort(); }
|
||||||
|
|
|
@ -40,6 +40,10 @@ const u8 *gossip_store_get_private_update(const tal_t *ctx UNNEEDED,
|
||||||
struct gossip_store *gs UNNEEDED,
|
struct gossip_store *gs UNNEEDED,
|
||||||
u64 offset UNNEEDED)
|
u64 offset UNNEEDED)
|
||||||
{ fprintf(stderr, "gossip_store_get_private_update called!\n"); abort(); }
|
{ fprintf(stderr, "gossip_store_get_private_update called!\n"); abort(); }
|
||||||
|
/* Generated stub for gossip_store_mark_channel_deleted */
|
||||||
|
void gossip_store_mark_channel_deleted(struct gossip_store *gs UNNEEDED,
|
||||||
|
const struct short_channel_id *scid UNNEEDED)
|
||||||
|
{ fprintf(stderr, "gossip_store_mark_channel_deleted called!\n"); abort(); }
|
||||||
/* Generated stub for json_add_member */
|
/* Generated stub for json_add_member */
|
||||||
void json_add_member(struct json_stream *js UNNEEDED,
|
void json_add_member(struct json_stream *js UNNEEDED,
|
||||||
const char *fieldname UNNEEDED,
|
const char *fieldname UNNEEDED,
|
||||||
|
|
Loading…
Add table
Reference in a new issue