From ce24731da96bff2f8047312f670362a9fa51afe3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 17 Aug 2017 10:34:55 +0930 Subject: [PATCH] lightningd: use internal_error rather than freeing peer. Should never free peer directly: we need to log error, etc. Signed-off-by: Rusty Russell --- lightningd/peer_control.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 595bfa249..cc1bf5d79 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -828,10 +828,8 @@ static void fail_fundchannel_command(struct funding_channel *fc) static void funding_broadcast_failed(struct peer *peer, int exitstatus, const char *err) { - log_unusual(peer->log, "Funding broadcast exited with %i: %s", - exitstatus, err); - /* FIXME: send PKT_ERR to peer if this happens. */ - tal_free(peer); + peer_internal_error(peer, "Funding broadcast exited with %i: %s", + exitstatus, err); } static enum watch_result funding_announce_cb(struct peer *peer, @@ -1676,9 +1674,8 @@ static bool opening_funder_finished(struct subd *opening, const u8 *resp, &channel_info->remote_fundingkey, &funding_txid, &channel_info->feerate_per_kw)) { - log_broken(fc->peer->log, "bad OPENING_FUNDER_REPLY %s", - tal_hex(resp, resp)); - tal_free(fc->peer); + peer_internal_error(fc->peer, "bad shutdown_complete: %s", + tal_hex(resp, resp)); return false; }