From 5571f2143e11072b5ca2fd6cc73dd435b69c45a5 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 26 Mar 2018 20:10:03 +0200 Subject: [PATCH] gossip: Added message to notify gossipd of outpoint spends Signed-off-by: Christian Decker --- gossipd/gossip.c | 10 ++++++++++ gossipd/gossip_wire.csv | 3 +++ lightningd/gossip_control.c | 1 + 3 files changed, 14 insertions(+) diff --git a/gossipd/gossip.c b/gossipd/gossip.c index 0e71f1714..beea84a1d 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -1987,6 +1987,13 @@ handle_mark_channel_unroutable(struct io_conn *conn, return daemon_conn_read_next(conn, &daemon->master); } +static struct io_plan *handle_outpoint_spent(struct io_conn *conn, + struct daemon *daemon, + const u8 *msg) +{ + return daemon_conn_read_next(conn, &daemon->master); +} + static struct io_plan *recv_req(struct io_conn *conn, struct daemon_conn *master) { struct daemon *daemon = container_of(master, struct daemon, master); @@ -2044,6 +2051,9 @@ static struct io_plan *recv_req(struct io_conn *conn, struct daemon_conn *master case WIRE_GOSSIPCTL_PEER_DISCONNECT: return disconnect_peer(conn, daemon, master->msg_in); + case WIRE_GOSSIP_OUTPOINT_SPENT: + return handle_outpoint_spent(conn, daemon, master->msg_in); + /* We send these, we don't receive them */ case WIRE_GOSSIPCTL_RELEASE_PEER_REPLY: case WIRE_GOSSIPCTL_RELEASE_PEER_REPLYFAIL: diff --git a/gossipd/gossip_wire.csv b/gossipd/gossip_wire.csv index 71a889a0a..c3e5775dd 100644 --- a/gossipd/gossip_wire.csv +++ b/gossipd/gossip_wire.csv @@ -225,6 +225,9 @@ gossipctl_peer_disconnect_reply,3123 gossipctl_peer_disconnect_replyfail,3223 gossipctl_peer_disconnect_replyfail,,isconnected,bool +# master -> gossipd: a potential funding outpoint was spent, please forget the eventual channel +gossip_outpoint_spent,3024 +gossip_outpoint_spent,,short_channel_id,struct short_channel_id # gossip_store messages: messages persisted in the gossip_store gossip_store_channel_announcement,4096 diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 21ec97f40..1a2958e97 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -133,6 +133,7 @@ static unsigned gossip_msg(struct subd *gossip, const u8 *msg, const int *fds) case WIRE_GOSSIP_SEND_GOSSIP: case WIRE_GOSSIP_GET_TXOUT_REPLY: case WIRE_GOSSIP_DISABLE_CHANNEL: + case WIRE_GOSSIP_OUTPOINT_SPENT: case WIRE_GOSSIP_ROUTING_FAILURE: case WIRE_GOSSIP_MARK_CHANNEL_UNROUTABLE: case WIRE_GOSSIPCTL_PEER_DISCONNECT: