lightningd: don't include empty error in onion returned on failed injectpaymentonion.

fail->msg can be NULL for local failures (the error message itself is more informative
in this case).  Use the generic "something went wrong" message.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-11-17 16:06:06 +10:30
parent ef475db478
commit d6152fdc40

View file

@ -1684,8 +1684,17 @@ injectonion_fail(struct command *cmd,
struct json_stream *js;
/* Turn local errors into onion reply. */
if (!onionreply)
onionreply = create_onionreply(tmpctx, shared_secret, fail->msg);
if (!onionreply) {
const u8 *err;
/* Local error with no context, use default error */
if (fail->msg)
err = fail->msg;
else
err = towire_temporary_channel_failure(tmpctx, NULL);
onionreply = create_onionreply(tmpctx, shared_secret, err);
}
js = json_stream_fail(cmd, PAY_INJECTPAYMENTONION_FAILED, errmsg);
/* We wrap the onion reply, as it expects. */