diff --git a/closingd/Makefile b/closingd/Makefile index 2cb6786b7..5e64e9f14 100644 --- a/closingd/Makefile +++ b/closingd/Makefile @@ -58,7 +58,8 @@ CLOSINGD_COMMON_OBJS := \ common/subdaemon.o \ common/type_to_string.o \ common/utils.o \ - common/version.o + common/version.o \ + common/wire_error.o closingd/gen_closing_wire.h: $(WIRE_GEN) closingd/closing_wire.csv $(WIRE_GEN) --header $@ closing_wire_type < closingd/closing_wire.csv > $@ diff --git a/common/peer_failed.c b/common/peer_failed.c index 5ee61bf6c..e1facd0f0 100644 --- a/common/peer_failed.c +++ b/common/peer_failed.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -31,9 +32,10 @@ void peer_failed(int peer_fd, struct crypto_state *cs, va_start(ap, fmt); errmsg = tal_vfmt(NULL, fmt, ap); va_end(ap); - /* Make sure it's correct length for error. */ - tal_resize(&errmsg, strlen(errmsg)+1); - msg = towire_error(errmsg, channel_id, (const u8 *)errmsg); + + va_start(ap, fmt); + msg = towire_errorfmtv(errmsg, channel_id, fmt, ap); + va_end(ap); /* This is only best-effort; don't block. */ io_fd_block(peer_fd, false);