Skip to content

Commit

Permalink
state: remove unnecessary set_errpkt() helper.
Browse files Browse the repository at this point in the history
This was needed when idata->pkt wasn't a tal pointer, for testing,
but now it always is anyway.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jan 21, 2016
1 parent 85f4a7c commit 2c356fd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
4 changes: 2 additions & 2 deletions state.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -845,7 +845,7 @@ struct state_effect *state(const tal_t *ctx,
*/
/* 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);
Expand Down
6 changes: 0 additions & 6 deletions test/test_state_coverage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2c356fd

Please sign in to comment.