From 61e3c0c23e834d741e56892d258118ea4cbeb6a1 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 8 Mar 2018 13:54:13 +1030 Subject: [PATCH] channeld: allow gossipd to fwd messages through us without updating gossip_index. Signed-off-by: Rusty Russell --- channeld/channel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/channeld/channel.c b/channeld/channel.c index 839f6cdd9..419756e36 100644 --- a/channeld/channel.c +++ b/channeld/channel.c @@ -306,12 +306,17 @@ static void enqueue_peer_msg(struct peer *peer, const u8 *msg TAKES) static void gossip_in(struct peer *peer, const u8 *msg) { u8 *gossip; + u64 gossip_index; - if (!fromwire_gossip_send_gossip(msg, msg, &peer->gossip_index, &gossip)) + if (!fromwire_gossip_send_gossip(msg, msg, &gossip_index, &gossip)) status_failed(STATUS_FAIL_GOSSIP_IO, "Got bad message from gossipd: %s", tal_hex(msg, msg)); + /* Zero is a special index meaning this is unindexed gossip. */ + if (gossip_index != 0) + peer->gossip_index = gossip_index; + if (is_msg_for_gossipd(gossip)) enqueue_peer_msg(peer, gossip); else if (fromwire_peektype(gossip) == WIRE_ERROR) {