mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
pkt_err: make it variadic.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
3374ddd2a6
commit
65cc6bbd50
2
state.h
2
state.h
@ -114,7 +114,7 @@ Pkt *pkt_htlc_routefail(const tal_t *ctx, const struct peer *peer,
|
||||
Pkt *pkt_update_accept(const tal_t *ctx, const struct peer *peer);
|
||||
Pkt *pkt_update_signature(const tal_t *ctx, const struct peer *peer);
|
||||
Pkt *pkt_update_complete(const tal_t *ctx, const struct peer *peer);
|
||||
Pkt *pkt_err(const tal_t *ctx, const char *msg);
|
||||
Pkt *pkt_err(const tal_t *ctx, const char *fmt, ...);
|
||||
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);
|
||||
|
@ -654,9 +654,17 @@ Pkt *pkt_update_complete(const tal_t *ctx, const struct peer *peer)
|
||||
peer->current_htlc.htlc.id);
|
||||
}
|
||||
|
||||
Pkt *pkt_err(const tal_t *ctx, const char *msg)
|
||||
Pkt *pkt_err(const tal_t *ctx, const char *fmt, ...)
|
||||
{
|
||||
return (Pkt *)tal_fmt(ctx, "PKT_ERROR: %s", msg);
|
||||
char *str;
|
||||
va_list ap;
|
||||
|
||||
str = tal_strdup(ctx, "PKT_ERROR: ");
|
||||
va_start(ap, fmt);
|
||||
tal_append_vfmt(&str, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return (Pkt *)str;
|
||||
}
|
||||
|
||||
Pkt *pkt_close(const tal_t *ctx, const struct peer *peer)
|
||||
@ -676,8 +684,7 @@ Pkt *pkt_close_ack(const tal_t *ctx, const struct peer *peer)
|
||||
|
||||
Pkt *pkt_err_unexpected(const tal_t *ctx, const Pkt *pkt)
|
||||
{
|
||||
return (Pkt *)tal_fmt(ctx, "PKT_ERROR: Unexpected pkt %s",
|
||||
(const char *)pkt);
|
||||
return pkt_err("Unexpected pkt %s", (const char *)pkt);
|
||||
}
|
||||
|
||||
Pkt *accept_pkt_open(const tal_t *ctx,
|
||||
|
Loading…
Reference in New Issue
Block a user