Browse Source

state: remove update_theirsig effect.

They get this from accept_pkt_update_accept() or accept_pkt_update_signature().

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

10
state.c

@ -486,15 +486,12 @@ enum command_status state(const tal_t *ctx,
change_peer_cond(peer, PEER_CMD_OK, PEER_BUSY);
goto accept_htlc_routefail;
} else if (input_is(input, PKT_UPDATE_ACCEPT)) {
struct signature *sig;
err = accept_pkt_update_accept(ctx, peer, idata->pkt,
&sig);
err = accept_pkt_update_accept(ctx, peer, idata->pkt);
if (err) {
peer_htlc_aborted(peer);
complete_cmd(peer, &cstatus, CMD_FAIL);
goto err_start_unilateral_close;
}
add_effect(effect, update_theirsig, sig);
add_effect(effect, send_pkt,
pkt_update_signature(ctx, peer));
/* HTLC is signed (though old tx not revoked yet!) */
@ -568,14 +565,11 @@ enum command_status state(const tal_t *ctx,
case STATE_WAIT_FOR_UPDATE_SIG_LOWPRIO:
case STATE_WAIT_FOR_UPDATE_SIG_HIGHPRIO:
if (input_is(input, PKT_UPDATE_SIGNATURE)) {
struct signature *sig;
err = accept_pkt_update_signature(ctx, peer, idata->pkt,
&sig);
err = accept_pkt_update_signature(ctx, peer, idata->pkt);
if (err) {
peer_htlc_aborted(peer);
goto err_start_unilateral_close;
}
add_effect(effect, update_theirsig, sig);
add_effect(effect, send_pkt,
pkt_update_complete(ctx, peer));

10
state.h

@ -13,7 +13,6 @@ enum state_effect_type {
STATE_EFFECT_unwatch,
/* FIXME: Use a watch for this?. */
STATE_EFFECT_close_timeout,
STATE_EFFECT_update_theirsig,
/* FIXME: Combine into watches? */
STATE_EFFECT_watch_htlcs,
STATE_EFFECT_unwatch_htlc,
@ -47,9 +46,6 @@ struct state_effect {
/* Set a timeout for close tx. */
enum state_input close_timeout;
/* Their signature for the new commit tx. */
struct signature *update_theirsig;
/* HTLC outputs to watch. */
const struct htlc_watch *watch_htlcs;
@ -200,16 +196,14 @@ Pkt *accept_pkt_htlc_fulfill(const tal_t *ctx,
struct peer *peer, const Pkt *pkt);
Pkt *accept_pkt_update_accept(const tal_t *ctx,
struct peer *peer, const Pkt *pkt,
struct signature **sig);
struct peer *peer, const Pkt *pkt);
Pkt *accept_pkt_update_complete(const tal_t *ctx,
struct peer *peer, const Pkt *pkt);
Pkt *accept_pkt_update_signature(const tal_t *ctx,
struct peer *peer,
const Pkt *pkt,
struct signature **sig);
const Pkt *pkt);
Pkt *accept_pkt_close(const tal_t *ctx,
const struct peer *peer, const Pkt *pkt,

10
test/test_state_coverage.c

@ -780,8 +780,7 @@ Pkt *accept_pkt_htlc_fulfill(const tal_t *ctx,
}
Pkt *accept_pkt_update_accept(const tal_t *ctx,
struct peer *peer, const Pkt *pkt,
struct signature **sig)
struct peer *peer, const Pkt *pkt)
{
unsigned int id = htlc_id_from_pkt(pkt);
@ -790,7 +789,6 @@ Pkt *accept_pkt_update_accept(const tal_t *ctx,
if (fail(peer, FAIL_ACCEPT_UPDATE_ACCEPT))
return pkt_err(ctx, "Error inject");
*sig = (struct signature *)tal_strdup(ctx, "from PKT_UPDATE_ACCEPT");
return NULL;
}
@ -808,8 +806,7 @@ Pkt *accept_pkt_update_complete(const tal_t *ctx,
}
Pkt *accept_pkt_update_signature(const tal_t *ctx,
struct peer *peer, const Pkt *pkt,
struct signature **sig)
struct peer *peer, const Pkt *pkt)
{
unsigned int id = htlc_id_from_pkt(pkt);
@ -817,7 +814,6 @@ Pkt *accept_pkt_update_signature(const tal_t *ctx,
if (fail(peer, FAIL_ACCEPT_UPDATE_SIGNATURE))
return pkt_err(ctx, "Error inject");
*sig = (struct signature *)tal_strdup(ctx, "from PKT_UPDATE_SIGNATURE");
return NULL;
}
@ -1556,8 +1552,6 @@ static const char *apply_effects(struct peer *peer,
assert(effect->u.close_timeout
== INPUT_CLOSE_COMPLETE_TIMEOUT);
break;
case STATE_EFFECT_update_theirsig:
break;
case STATE_EFFECT_watch_htlcs:
assert(peer->num_live_htlcs_to_us
+ effect->u.watch_htlcs->num_htlcs_to_us

Loading…
Cancel
Save