diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index a58db2353..7618fa0ac 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -16,6 +16,7 @@ #include #include #include +#include /* Mutual recursion via timer. */ static void try_extend_tip(struct chain_topology *topo); @@ -415,6 +416,7 @@ static void topo_update_spends(struct chain_topology *topo, struct block *b) b->height, &input->txid, input->index); if (scid) { + gossipd_notify_spend(topo->bitcoind->ld, scid); tal_free(scid); } } diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 1a2958e97..ae6908622 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -216,6 +216,13 @@ void gossip_init(struct lightningd *ld) subd_send_msg(ld->gossip, msg); } +void gossipd_notify_spend(struct lightningd *ld, + const struct short_channel_id *scid) +{ + u8 *msg = towire_gossip_outpoint_spent(tmpctx, scid); + subd_send_msg(ld->gossip, msg); +} + static void json_getnodes_reply(struct subd *gossip UNUSED, const u8 *reply, const int *fds UNUSED, struct command *cmd) diff --git a/lightningd/gossip_control.h b/lightningd/gossip_control.h index 8a4d6febc..ec0683b37 100644 --- a/lightningd/gossip_control.h +++ b/lightningd/gossip_control.h @@ -1,10 +1,15 @@ #ifndef LIGHTNING_LIGHTNINGD_GOSSIP_CONTROL_H #define LIGHTNING_LIGHTNINGD_GOSSIP_CONTROL_H #include "config.h" +#include #include #include struct lightningd; void gossip_init(struct lightningd *ld); + +void gossipd_notify_spend(struct lightningd *ld, + const struct short_channel_id *scid); + #endif /* LIGHTNING_LIGHTNINGD_GOSSIP_CONTROL_H */