Browse Source

state: remove unnecessary set_errpkt() helper.

This was needed when idata->pkt wasn't a tal pointer, for testing,
but now it always is anyway.

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

4
state.c

@ -547,7 +547,7 @@ struct state_effect *state(const tal_t *ctx,
return next_state(ctx, effect, STATE_CLOSE_WAIT_CLOSE);
} else if (input_is(input, PKT_ERROR)) {
add_effect(&effect, in_error,
set_errpkt(ctx, idata->pkt));
tal_steal(ctx, idata->pkt));
goto start_unilateral_close_already_closing;
} else if (input_is_pkt(input)) {
/* We ignore all other packets while closing. */
@ -845,7 +845,7 @@ unexpected_pkt:
*/
/* Don't reply to an error with an error. */
if (input_is(input, PKT_ERROR)) {
add_effect(&effect, in_error, set_errpkt(ctx, idata->pkt));
add_effect(&effect, in_error, tal_steal(ctx, idata->pkt));
goto start_unilateral_close;
}
err = unexpected_pkt(ctx, input);

6
test/test_state_coverage.c

@ -482,12 +482,6 @@ static enum state_input input_by_name(const char *name)
abort();
}
/* We don't bother with lifetime issues */
static Pkt *set_errpkt(const tal_t *ctx, const Pkt *pkt)
{
return (Pkt *)pkt;
}
static Pkt *new_pkt(const tal_t *ctx, enum state_input i)
{
return (Pkt *)input_name(i);

Loading…
Cancel
Save