mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 18:57:06 +01:00
is_all_channels: rename to channel_id_is_all
Suggested-by: Christian Decker Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
1954844fbf
commit
74e684cc0d
3 changed files with 12 additions and 13 deletions
|
@ -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);
|
||||
|
|
|
@ -32,10 +32,16 @@ u8 *towire_errorfmtv(const tal_t *ctx,
|
|||
const char *fmt,
|
||||
va_list ap);
|
||||
|
||||
/**
|
||||
* is_all_channels - True if channel_id is all zeroes.
|
||||
/* 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.
|
||||
*/
|
||||
bool is_all_channels(const struct channel_id *channel_id);
|
||||
/**
|
||||
* channel_id_is_all - True if channel_id is all zeroes.
|
||||
*/
|
||||
bool channel_id_is_all(const struct channel_id *channel_id);
|
||||
|
||||
/**
|
||||
* sanitize_error - extract and sanitize contents of WIRE_ERROR.
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue