From 74e684cc0db71cefffae4465cbaac8d262ba2ed4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 22 Oct 2017 19:33:03 +1030 Subject: [PATCH] is_all_channels: rename to channel_id_is_all Suggested-by: Christian Decker Signed-off-by: Rusty Russell --- common/wire_error.c | 11 ++--------- common/wire_error.h | 10 ++++++++-- gossipd/gossip.c | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/common/wire_error.c b/common/wire_error.c index e0c1d21b6..9ed3d2c33 100644 --- a/common/wire_error.c +++ b/common/wire_error.c @@ -43,15 +43,8 @@ u8 *towire_errorfmt(const tal_t *ctx, return msg; } -bool is_all_channels(const struct channel_id *channel_id) +bool channel_id_is_all(const struct channel_id *channel_id) { - /* BOLT #1: - * - * A node receiving `error` MUST fail the channel referred to by the - * message, or if `channel_id` is zero, it MUST fail all channels and - * MUST close the connection. If no existing channel is referred to - * by the message, the receiver MUST ignore the message. - */ return memeqzero(channel_id, sizeof(*channel_id)); } @@ -86,7 +79,7 @@ char *sanitize_error(const tal_t *ctx, const u8 *errmsg, } return tal_fmt(ctx, "channel %s: %.*s", - is_all_channels(channel_id) + channel_id_is_all(channel_id) ? "ALL" : type_to_string(ctx, struct channel_id, channel_id), (int)tal_len(data), (char *)data); diff --git a/common/wire_error.h b/common/wire_error.h index 78a4e388f..23dd2b4cc 100644 --- a/common/wire_error.h +++ b/common/wire_error.h @@ -32,10 +32,16 @@ u8 *towire_errorfmtv(const tal_t *ctx, const char *fmt, va_list ap); +/* BOLT #1: + * + * A node receiving `error` MUST fail the channel referred to by the message, + * or if `channel_id` is zero, it MUST fail all channels and MUST close the + * connection. + */ /** - * is_all_channels - True if channel_id is all zeroes. + * channel_id_is_all - True if channel_id is all zeroes. */ -bool is_all_channels(const struct channel_id *channel_id); +bool channel_id_is_all(const struct channel_id *channel_id); /** * sanitize_error - extract and sanitize contents of WIRE_ERROR. diff --git a/gossipd/gossip.c b/gossipd/gossip.c index 235b03f58..6d5065afd 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -267,7 +267,7 @@ static bool is_all_channel_error(const u8 *msg) if (!fromwire_error(msg, msg, NULL, &channel_id, &data)) return false; tal_free(data); - return is_all_channels(&channel_id); + return channel_id_is_all(&channel_id); } static struct io_plan *peer_close_after_error(struct io_conn *conn,