Browse Source

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>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
9842e32e06
  1. 9
      lightningd/channel.c

9
lightningd/channel.c

@ -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, ...)

Loading…
Cancel
Save