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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-07-02 14:00:16 +09:30 committed by Christian Decker
parent efee948d3a
commit 5a184c24e8
1 changed files with 6 additions and 0 deletions

View File

@ -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",