From 7fd2f6db6dd326cdbcfd96f052850b4638f5fc93 Mon Sep 17 00:00:00 2001 From: darosior Date: Tue, 1 Oct 2019 22:44:44 +0200 Subject: [PATCH] gossipd: query_messages: fail the connection if peer says it does not have up-to-date infos It is most likely not on the same network, and in any case not a good peer to gossip with. --- gossipd/queries.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gossipd/queries.c b/gossipd/queries.c index 188a1198b..4878b716c 100644 --- a/gossipd/queries.c +++ b/gossipd/queries.c @@ -678,6 +678,10 @@ const u8 *handle_reply_channel_range(struct peer *peer, const u8 *msg) scids = decode_short_ids(tmpctx, encoded); if (!scids) { + if (complete == 0) + return towire_errorfmt(peer, NULL, + "No up to date infos about this network: %s", + tal_hex(tmpctx, msg)); return towire_errorfmt(peer, NULL, "Bad reply_channel_range encoding %s", tal_hex(tmpctx, encoded)); @@ -784,6 +788,11 @@ const u8 *handle_reply_short_channel_ids_end(struct peer *peer, const u8 *msg) tal_hex(tmpctx, msg)); } + if (complete == 0) + return towire_errorfmt(peer, NULL, + "No up to date infos about this network: %s", + tal_hex(tmpctx, msg)); + peer->scid_query_outstanding = false; if (peer->scid_query_cb) peer->scid_query_cb(peer, complete);