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

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-01-22 06:41:45 +10:30
parent 93b5db89a8
commit 4d22b4e3eb
3 changed files with 10 additions and 4 deletions

View File

@ -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)) {

View File

@ -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);

View File

@ -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);
}