state: use peer_unexpected_pkt() for an unexpected packet.

Instead of effect->in_error.

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

View File

@@ -18,7 +18,6 @@ enum state_peercond {
};
enum state_effect_type {
STATE_EFFECT_in_error,
STATE_EFFECT_broadcast_tx,
STATE_EFFECT_send_pkt,
STATE_EFFECT_watch,
@@ -63,9 +62,6 @@ struct state_effect {
/* Set a timeout for close tx. */
enum state_input close_timeout;
/* Error received from other side. */
Pkt *in_error;
/* HTLC we're working on. */
struct htlc_progress *htlc_in_progress;
@@ -155,6 +151,9 @@ static inline bool input_is(enum state_input a, enum state_input b)
struct signature;
/* Inform peer have an unexpected packet. */
void peer_unexpected_pkt(struct peer *peer, const Pkt *pkt);
/* Create various kinds of packets, allocated off @ctx */
Pkt *pkt_open(const tal_t *ctx, const struct peer *peer,
OpenChannel__AnchorOffer anchor);
@@ -176,7 +175,7 @@ Pkt *pkt_err(const tal_t *ctx, const char *msg);
Pkt *pkt_close(const tal_t *ctx, const struct peer *peer);
Pkt *pkt_close_complete(const tal_t *ctx, const struct peer *peer);
Pkt *pkt_close_ack(const tal_t *ctx, const struct peer *peer);
Pkt *unexpected_pkt(const tal_t *ctx, enum state_input input);
Pkt *pkt_err_unexpected(const tal_t *ctx, const Pkt *pkt);
/* Process various packets: return an error packet on failure. */
Pkt *accept_pkt_open(const tal_t *ctx,