From 5a184c24e834beee3158866e90024bdd4290ba8f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 2 Jul 2018 14:00:16 +0930 Subject: [PATCH] channeld: add extra check to channel_force_htlcs. None of these sanity checks should fail, but let's be thorough: we were testing for htlc->fail but not failcode when fulfilling an HTLC. The failing-htlc case had this correct already. Signed-off-by: Rusty Russell --- channeld/full_channel.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/channeld/full_channel.c b/channeld/full_channel.c index be844fb26..b93a2a80f 100644 --- a/channeld/full_channel.c +++ b/channeld/full_channel.c @@ -996,6 +996,12 @@ bool channel_force_htlcs(struct channel *channel, fulfilled[i].id); return false; } + if (htlc->failcode) { + status_trace("Fulfill %s HTLC %"PRIu64" already fail %u", + fulfilled_sides[i] == LOCAL ? "out" : "in", + fulfilled[i].id, htlc->failcode); + return false; + } if (!htlc_has(htlc, HTLC_REMOVING)) { status_trace("Fulfill %s HTLC %"PRIu64" state %s", fulfilled_sides[i] == LOCAL ? "out" : "in",