Browse Source

funding: trivial variable rename

"state" is reserved for lightningd_state; use cstate in
initial_funding() like everywhere else.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
4c3370e023
  1. 24
      funding.c

24
funding.c

@ -119,30 +119,30 @@ struct channel_state *initial_funding(const tal_t *ctx,
uint64_t anchor_satoshis, uint64_t anchor_satoshis,
uint64_t fee) uint64_t fee)
{ {
struct channel_state *state = talz(ctx, struct channel_state); struct channel_state *cstate = talz(ctx, struct channel_state);
state->a.htlcs = tal_arr(state, struct channel_htlc, 0); cstate->a.htlcs = tal_arr(cstate, struct channel_htlc, 0);
state->b.htlcs = tal_arr(state, struct channel_htlc, 0); cstate->b.htlcs = tal_arr(cstate, struct channel_htlc, 0);
if (fee > anchor_satoshis) if (fee > anchor_satoshis)
return tal_free(state); return tal_free(cstate);
if (anchor_satoshis > (1ULL << 32) / 1000) if (anchor_satoshis > (1ULL << 32) / 1000)
return tal_free(state); return tal_free(cstate);
/* Initially, all goes back to funder. */ /* Initially, all goes back to funder. */
state->a.pay_msat = anchor_satoshis * 1000 - fee * 1000; cstate->a.pay_msat = anchor_satoshis * 1000 - fee * 1000;
state->a.fee_msat = fee * 1000; cstate->a.fee_msat = fee * 1000;
state->a.offered_anchor = true; cstate->a.offered_anchor = true;
state->b.offered_anchor = false; cstate->b.offered_anchor = false;
/* If B (not A) is funder, invert. */ /* If B (not A) is funder, invert. */
if (!am_funder) if (!am_funder)
invert_cstate(state); invert_cstate(cstate);
/* Make sure it checks out. */ /* Make sure it checks out. */
assert(funding_delta(anchor_satoshis, 0, 0, &state->a, &state->b)); assert(funding_delta(anchor_satoshis, 0, 0, &cstate->a, &cstate->b));
return state; return cstate;
} }
bool adjust_fee(uint64_t anchor_satoshis, bool adjust_fee(uint64_t anchor_satoshis,

Loading…
Cancel
Save