From 4e5ced4de252dc5271e4f7df18aadacbcdef2b15 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 22 Jan 2016 06:45:28 +1030 Subject: [PATCH] daemon: don't crash on pkt_err We're about to test it, for anchor timeout. Signed-off-by: Rusty Russell --- daemon/packets.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/daemon/packets.c b/daemon/packets.c index 06566125e..86bfc6d67 100644 --- a/daemon/packets.c +++ b/daemon/packets.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #define FIXME_STUB(peer) do { log_broken((peer)->dstate->base_log, "%s:%u: Implement %s!", __FILE__, __LINE__, __func__); abort(); } while(0) @@ -237,7 +238,15 @@ Pkt *pkt_update_complete(const tal_t *ctx, const struct peer *peer) Pkt *pkt_err(const tal_t *ctx, const char *msg, ...) { - abort(); + Error *e = tal(ctx, Error); + va_list ap; + + error__init(e); + va_start(ap, msg); + e->problem = tal_vfmt(ctx, msg, ap); + va_end(ap); + + return make_pkt(ctx, PKT__PKT_ERROR, e); } Pkt *pkt_close(const tal_t *ctx, const struct peer *peer)