lightningd: expose internal error information.

In #1018 we got no information, except "Internal error".  At least
if we tell the other side what went wrong, we're more likely to get
an answer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-02-20 20:21:44 +10:30 committed by Christian Decker
parent 1192f16733
commit 9842e32e06

View File

@ -297,14 +297,15 @@ void channel_fail_permanent(struct channel *channel, const char *fmt, ...)
void channel_internal_error(struct channel *channel, const char *fmt, ...) void channel_internal_error(struct channel *channel, const char *fmt, ...)
{ {
va_list ap; va_list ap;
char *why;
va_start(ap, fmt); va_start(ap, fmt);
log_broken(channel->log, "Peer internal error %s: ", why = tal_vfmt(channel, fmt, ap);
channel_state_name(channel));
logv_add(channel->log, fmt, ap);
va_end(ap); va_end(ap);
channel_fail_permanent(channel, "Internal error"); log_broken(channel->log, "Peer internal error %s: %s",
channel_state_name(channel), why);
channel_fail_permanent(channel, "Internal error: %s", why);
} }
void channel_fail_transient(struct channel *channel, const char *fmt, ...) void channel_fail_transient(struct channel *channel, const char *fmt, ...)