Browse Source

pkt_open: use flag to indicate whether packet will offer anchor.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
4d22b4e3eb
  1. 8
      state.c
  2. 3
      state.h
  3. 3
      test/test_state_coverage.c

8
state.c

@ -109,11 +109,15 @@ enum state state(const enum state state, const struct state_data *sdata,
*/
case STATE_INIT_NOANCHOR:
assert(input == INPUT_NONE);
set_effect(effect, send, pkt_open(effect, sdata));
set_effect(effect, send,
pkt_open(effect, sdata,
OPEN_CHANNEL__ANCHOR_OFFER__WONT_CREATE_ANCHOR));
return STATE_OPEN_WAIT_FOR_OPEN_NOANCHOR;
case STATE_INIT_WITHANCHOR:
assert(input == INPUT_NONE);
set_effect(effect, send, pkt_open(effect, sdata));
set_effect(effect, send,
pkt_open(effect, sdata,
OPEN_CHANNEL__ANCHOR_OFFER__WILL_CREATE_ANCHOR));
return STATE_OPEN_WAIT_FOR_OPEN_WITHANCHOR;
case STATE_OPEN_WAIT_FOR_OPEN_NOANCHOR:
if (input_is(input, PKT_OPEN)) {

3
state.h

@ -131,7 +131,8 @@ static inline bool input_is(enum state_input a, enum state_input b)
struct signature;
/* Create various kinds of packets, allocated off @ctx */
Pkt *pkt_open(const tal_t *ctx, const struct state_data *sdata);
Pkt *pkt_open(const tal_t *ctx, const struct state_data *sdata,
OpenChannel__AnchorOffer anchor);
Pkt *pkt_anchor(const tal_t *ctx, const struct state_data *sdata);
Pkt *pkt_open_commit_sig(const tal_t *ctx, const struct state_data *sdata);
Pkt *pkt_open_complete(const tal_t *ctx, const struct state_data *sdata);

3
test/test_state_coverage.c

@ -564,7 +564,8 @@ static struct htlc *find_htlc_spend(const struct state_data *sdata,
return (struct htlc *)h;
}
Pkt *pkt_open(const tal_t *ctx, const struct state_data *sdata)
Pkt *pkt_open(const tal_t *ctx, const struct state_data *sdata,
OpenChannel__AnchorOffer anchor)
{
return new_pkt(ctx, PKT_OPEN);
}

Loading…
Cancel
Save