From ca2d389920abb8e9aa44fae3f8046f8449228b36 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 16 Feb 2026 11:31:21 +1030 Subject: [PATCH] devtools/gossipwith: don't count "padding" pings towards max-messages count. We are about to use them to make our packet size constant, and this will upset the tests. Signed-off-by: Rusty Russell --- devtools/gossipwith.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/devtools/gossipwith.c b/devtools/gossipwith.c index 7f85e8eec..c282c9924 100644 --- a/devtools/gossipwith.c +++ b/devtools/gossipwith.c @@ -256,16 +256,22 @@ static struct io_plan *handshake_success(struct io_conn *conn, } } else if (pollfd[1].revents & POLLIN) { u8 *pong; + bool is_padding; msg = sync_crypto_read(NULL, peer_fd, cs); if (!msg) err(1, "Reading msg"); - if (handle_pings - && fromwire_peektype(msg) == WIRE_PING - && check_ping_make_pong(tmpctx, msg, &pong) - && pong) { - sync_crypto_write(peer_fd, cs, take(pong)); - } + if (check_ping_make_pong(tmpctx, msg, &pong)) { + if (!pong) + is_padding = true; + else { + is_padding = false; + if (handle_pings) + sync_crypto_write(peer_fd, cs, take(pong)); + } + } else + is_padding = false; + if (!accept_message(msg)) { tal_free(msg); continue; @@ -278,7 +284,9 @@ static struct io_plan *handshake_success(struct io_conn *conn, || !write_all(STDOUT_FILENO, msg, tal_bytelen(msg))) err(1, "Writing out msg"); } - --max_messages; + /* Don't count "padding" pings as real messages */ + if (!is_padding) + --max_messages; tal_free(msg); } }