Browse Source

gossipd: add tombstone when we remove a channel.

For those following along at home.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
bump-pyln-proto
Rusty Russell 4 years ago
parent
commit
7dd6f8f2b5
  1. 10
      gossipd/gossip_store.c
  2. 7
      gossipd/gossip_store.h
  3. 4
      gossipd/gossip_store_wire.csv
  4. 1
      gossipd/routing.c
  5. 3
      gossipd/test/run-bench-find_route.c
  6. 4
      gossipd/test/run-check_channel_announcement.c
  7. 3
      gossipd/test/run-find_route-specific.c
  8. 3
      gossipd/test/run-find_route.c
  9. 3
      gossipd/test/run-overlong.c
  10. 4
      gossipd/test/run-txout_failure.c

10
gossipd/gossip_store.c

@ -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;

7
gossipd/gossip_store.h

@ -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.
* *

4
gossipd/gossip_store_wire.csv

@ -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,

Can't render this file because it has a wrong number of fields in line 2.

1
gossipd/routing.c

@ -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;

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

@ -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(); }

4
gossipd/test/run-check_channel_announcement.c

@ -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)

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

@ -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(); }

3
gossipd/test/run-find_route.c

@ -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(); }

3
gossipd/test/run-overlong.c

@ -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(); }

4
gossipd/test/run-txout_failure.c

@ -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…
Cancel
Save