Skip to content

Commit

Permalink
pkt_open: use flag to indicate whether packet will offer anchor.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jan 21, 2016
1 parent 93b5db8 commit 4d22b4e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions state.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
3 changes: 2 additions & 1 deletion state.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion test/test_state_coverage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 4d22b4e

Please sign in to comment.