From 1192f16733f5c7cdbf8592e492ca734d6826b1ea Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 20 Feb 2018 20:53:37 +1030 Subject: [PATCH] lightningd: fix crash when htlc failed and source is onchain. If the source channel is onchain, we try to send a message to onchaind which (1) doesn't care, (2) doesn't take a channel_fail_htlc msg, and (3) causes us to crash in subd.c: assert(!strstarts(sd->msgname(fromwire_peektype(msg_out)), "INVALID")); Fixes: #821 Signed-off-by: Rusty Russell --- lightningd/peer_htlcs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index fe8ef2196..7c9e12ba2 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -105,6 +105,10 @@ static void fail_in_htlc(struct htlc_in *hin, if (!hin->key.channel->owner) return; + /* onchaind doesn't care, it can't do anything but wait */ + if (channel_on_chain(hin->key.channel)) + return; + subd_send_msg(hin->key.channel->owner, take(towire_channel_fail_htlc(hin, hin->key.id,