Browse Source

channel: assert htlc direction is correct.

The HTLC state encodes the creator; this should match the side argument.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
7b2d6925a0
  1. 3
      daemon/channel.c

3
daemon/channel.c

@ -219,6 +219,7 @@ bool cstate_add_htlc(struct channel_state *cstate,
size_t n, nondust;
struct channel_oneside *creator, *recipient;
assert(htlc_channel_side(htlc) == side);
creator = &cstate->side[side];
recipient = &cstate->side[!side];
@ -283,6 +284,7 @@ void cstate_fail_htlc(struct channel_state *cstate,
struct htlc *htlc,
enum channel_side side)
{
assert(htlc_channel_side(htlc) == side);
remove_htlc(cstate, side, side, htlc);
}
@ -290,6 +292,7 @@ void cstate_fulfill_htlc(struct channel_state *cstate,
struct htlc *htlc,
enum channel_side side)
{
assert(htlc_channel_side(htlc) == side);
remove_htlc(cstate, side, !side, htlc);
}

Loading…
Cancel
Save