From ea1a891d3f10deff9a1477965a5382f438d73eee Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 10 Mar 2017 15:11:54 +0100 Subject: [PATCH] channel: Forwarding incoming gossip messages to gossipd --- lightningd/channel/channel.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lightningd/channel/channel.c b/lightningd/channel/channel.c index fbc17a9bb..f0f9236a7 100644 --- a/lightningd/channel/channel.c +++ b/lightningd/channel/channel.c @@ -93,7 +93,7 @@ static struct io_plan *gossip_client_recv(struct io_conn *conn, if (type == WIRE_CHANNEL_ANNOUNCEMENT || type == WIRE_CHANNEL_UPDATE || type == WIRE_NODE_ANNOUNCEMENT) - queue_pkt(peer, msg); + queue_pkt(peer, tal_dup_arr(dc->ctx, u8, msg, tal_len(msg), 0)); return daemon_conn_read_next(conn, dc); } @@ -110,9 +110,10 @@ static struct io_plan *peer_out(struct io_conn *conn, struct peer *peer) static struct io_plan *peer_in(struct io_conn *conn, struct peer *peer, u8 *msg) { struct channel_id chanid; + int type = fromwire_peektype(msg); + + status_trace("Received %s from peer", wire_type_name(type)); - status_trace("Received %s from peer", - wire_type_name(fromwire_peektype(msg))); if (fromwire_funding_locked(msg, NULL, &chanid, &peer->next_per_commit[REMOTE])) { @@ -129,7 +130,11 @@ static struct io_plan *peer_in(struct io_conn *conn, struct peer *peer, u8 *msg) if (peer->funding_locked[LOCAL]) status_send(towire_channel_normal_operation(peer)); } - /* FIXME: Process gossip. */ + + if (type == WIRE_CHANNEL_ANNOUNCEMENT || type == WIRE_CHANNEL_UPDATE || + type == WIRE_NODE_ANNOUNCEMENT) { + daemon_conn_send(&peer->gossip_client, msg); + } return peer_read_message(conn, &peer->pcs, peer_in); }