Skip to content

Commit 7fd2f6d

Browse files
darosiorniftynei
authored andcommitted
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.
1 parent 2638947 commit 7fd2f6d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gossipd/queries.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,10 @@ const u8 *handle_reply_channel_range(struct peer *peer, const u8 *msg)
678678

679679
scids = decode_short_ids(tmpctx, encoded);
680680
if (!scids) {
681+
if (complete == 0)
682+
return towire_errorfmt(peer, NULL,
683+
"No up to date infos about this network: %s",
684+
tal_hex(tmpctx, msg));
681685
return towire_errorfmt(peer, NULL,
682686
"Bad reply_channel_range encoding %s",
683687
tal_hex(tmpctx, encoded));
@@ -784,6 +788,11 @@ const u8 *handle_reply_short_channel_ids_end(struct peer *peer, const u8 *msg)
784788
tal_hex(tmpctx, msg));
785789
}
786790

791+
if (complete == 0)
792+
return towire_errorfmt(peer, NULL,
793+
"No up to date infos about this network: %s",
794+
tal_hex(tmpctx, msg));
795+
787796
peer->scid_query_outstanding = false;
788797
if (peer->scid_query_cb)
789798
peer->scid_query_cb(peer, complete);

0 commit comments

Comments
 (0)