From e440799b5e20f6a0f7ae987e263e5bfb68baa6d3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 10 Feb 2025 12:18:49 +1030 Subject: [PATCH] devtools: have dump-gossipstore print malformed warnings to stdout. If they go to stderr, you can't associate them with the record they're talking about. Signed-off-by: Rusty Russell --- devtools/dump-gossipstore.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/devtools/dump-gossipstore.c b/devtools/dump-gossipstore.c index 159981666..6cd6d29b2 100644 --- a/devtools/dump-gossipstore.c +++ b/devtools/dump-gossipstore.c @@ -78,14 +78,12 @@ int main(int argc, char *argv[]) if (read(fd, msg, msglen) != msglen) errx(1, "%zu: Truncated file?", off); - if (be32_to_cpu(hdr.crc) - != crc32c(be32_to_cpu(hdr.timestamp), msg, msglen)) - warnx("Checksum verification failed"); - - printf("%zu: %s%s%s", off, + printf("%zu: %s%s%s%s", off, deleted ? "DELETED " : "", push ? "PUSH " : "", - dying ? "DYING " : ""); + dying ? "DYING " : "", + be32_to_cpu(hdr.crc) != crc32c(be32_to_cpu(hdr.timestamp), msg, msglen) ? "**BAD CHECKSUM** " : ""); + if (print_timestamp) printf("T=%u ", be32_to_cpu(hdr.timestamp)); if (deleted && !print_deleted) { @@ -125,8 +123,8 @@ int main(int argc, char *argv[]) fmt_short_channel_id(tmpctx, scid), blockheight); } else { - warnx("Unknown message %u", - fromwire_peektype(msg)); + printf("Unknown message %u: %s\n", + fromwire_peektype(msg), tal_hex(msg, msg)); } end: off += sizeof(hdr) + msglen;