Skip to content

Commit ebf78bc

Browse files
committed
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 <[email protected]>
1 parent b1a451c commit ebf78bc

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: devtools/dump-gossipstore.c

+6-8
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,12 @@ int main(int argc, char *argv[])
7878
if (read(fd, msg, msglen) != msglen)
7979
errx(1, "%zu: Truncated file?", off);
8080

81-
if (be32_to_cpu(hdr.crc)
82-
!= crc32c(be32_to_cpu(hdr.timestamp), msg, msglen))
83-
warnx("Checksum verification failed");
84-
85-
printf("%zu: %s%s%s", off,
81+
printf("%zu: %s%s%s%s", off,
8682
deleted ? "DELETED " : "",
8783
push ? "PUSH " : "",
88-
dying ? "DYING " : "");
84+
dying ? "DYING " : "",
85+
be32_to_cpu(hdr.crc) != crc32c(be32_to_cpu(hdr.timestamp), msg, msglen) ? "**BAD CHECKSUM** " : "");
86+
8987
if (print_timestamp)
9088
printf("T=%u ", be32_to_cpu(hdr.timestamp));
9189
if (deleted && !print_deleted) {
@@ -125,8 +123,8 @@ int main(int argc, char *argv[])
125123
fmt_short_channel_id(tmpctx, scid),
126124
blockheight);
127125
} else {
128-
warnx("Unknown message %u",
129-
fromwire_peektype(msg));
126+
printf("Unknown message %u: %s\n",
127+
fromwire_peektype(msg), tal_hex(msg, msg));
130128
}
131129
end:
132130
off += sizeof(hdr) + msglen;

0 commit comments

Comments
 (0)