Skip to content

Commit

Permalink
channeld: add extra check to channel_force_htlcs.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Jul 8, 2018
1 parent efee948 commit 5a184c2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions channeld/full_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5a184c2

Please sign in to comment.