Skip to content

Commit b5d1ace

Browse files
committed
wire: call unknown types "UNKNOWN X" not "INVALID X".
It's freaking people out when they see things like: ``` 2024-11-11T05:26:41.281Z DEBUG ...53c-connectd: peer_out INVALID 22859 ``` Fixes: #7802 Signed-off-by: Rusty Russell <[email protected]> Changelog-Changed: connectd: log unknown messages as "UNKNOWN" not "INVALID" to avoid freaking people out.
1 parent 1131568 commit b5d1ace

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

channeld/full_channel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,13 +1658,13 @@ bool channel_force_htlcs(struct channel *channel,
16581658

16591659
const char *channel_add_err_name(enum channel_add_err e)
16601660
{
1661-
static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)];
1661+
static char invalidbuf[sizeof("UNKNOWN ") + STR_MAX_CHARS(e)];
16621662

16631663
for (size_t i = 0; enum_channel_add_err_names[i].name; i++) {
16641664
if (enum_channel_add_err_names[i].v == e)
16651665
return enum_channel_add_err_names[i].name;
16661666
}
1667-
snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e);
1667+
snprintf(invalidbuf, sizeof(invalidbuf), "UNKNOWN %i", e);
16681668
return invalidbuf;
16691669
}
16701670

lightningd/pay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ json_add_routefail_info(struct json_stream *js,
219219
json_add_num(js, "erring_index", erring_index);
220220
json_add_num(js, "failcode", failcode);
221221
/* FIXME: Better way to detect this? */
222-
if (!strstarts(failcodename, "INVALID "))
222+
if (!strstarts(failcodename, "UNKNOWN "))
223223
json_add_string(js, "failcodename", failcodename);
224224

225225
if (erring_node != NULL)

lightningd/subd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ void subd_send_msg(struct subd *sd, const u8 *msg_out)
839839
u16 type = fromwire_peektype(msg_out);
840840
/* FIXME: We should use unique upper bits for each daemon, then
841841
* have generate-wire.py add them, just assert here. */
842-
if (strstarts(sd->msgname(type), "INVALID"))
842+
if (strstarts(sd->msgname(type), "UNKNOWN"))
843843
fatal("Sending %s an invalid message %s", sd->name, tal_hex(tmpctx, msg_out));
844844
msg_enqueue(sd->outq, msg_out);
845845
}

tools/gen/impl_template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ ${i}
2424

2525
const char *${enum_set['name']}_name(int e)
2626
{
27-
static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)];
27+
static char invalidbuf[sizeof("UNKNOWN ") + STR_MAX_CHARS(e)];
2828

2929
switch ((enum ${enum_set['name']})e) {
3030
% for msg in enum_set['set']:
3131
case ${msg.enum_name()}: return "${msg.enum_name()}";
3232
% endfor
3333
}
3434

35-
snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e);
35+
snprintf(invalidbuf, sizeof(invalidbuf), "UNKNOWN %i", e);
3636
return invalidbuf;
3737
}
3838

0 commit comments

Comments
 (0)