|
@ -15,22 +15,28 @@ bool check_ping_make_pong(const tal_t *ctx, const u8 *ping, u8 **pong) |
|
|
/* FIXME: */ |
|
|
/* FIXME: */ |
|
|
/* BOLT #1:
|
|
|
/* BOLT #1:
|
|
|
* |
|
|
* |
|
|
* A node receiving a `ping` message SHOULD fail the channels if it |
|
|
* A node receiving a `ping` message: |
|
|
* has received significantly in excess of one `ping` per 30 seconds, |
|
|
* - SHOULD fail the channels if it has received significantly in |
|
|
|
|
|
* excess of one `ping` per 30 seconds. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
/* BOLT #1:
|
|
|
/* BOLT #1:
|
|
|
* |
|
|
* |
|
|
* ... otherwise if `num_pong_bytes` is less than 65532 it MUST |
|
|
* A node receiving a `ping` message: |
|
|
* respond by sending a `pong` message with `byteslen` equal to |
|
|
*... |
|
|
* `num_pong_bytes`, otherwise it MUST ignore the `ping`. |
|
|
* - if `num_pong_bytes` is less than 65532: |
|
|
|
|
|
* - MUST respond by sending a `pong` message, with `byteslen` equal |
|
|
|
|
|
* to `num_pong_bytes`. |
|
|
|
|
|
* - otherwise (`num_pong_bytes` is **not** less than 65532): |
|
|
|
|
|
* - MUST ignore the `ping`. |
|
|
*/ |
|
|
*/ |
|
|
if (num_pong_bytes < 65532) { |
|
|
if (num_pong_bytes < 65532) { |
|
|
/* BOLT #1:
|
|
|
/* BOLT #1:
|
|
|
* |
|
|
* |
|
|
* A node sending `pong` or `ping` SHOULD set `ignored` to |
|
|
* A node sending a `pong` message: |
|
|
* zeroes, but MUST NOT set `ignored` to sensitive data such |
|
|
* - SHOULD set `ignored` to 0s. |
|
|
* as secrets, or portions of initialized memory. |
|
|
* - MUST NOT set `ignored` to sensitive data such as secrets |
|
|
|
|
|
* or portions of initialized memory. |
|
|
*/ |
|
|
*/ |
|
|
ignored = tal_arrz(ctx, u8, num_pong_bytes); |
|
|
ignored = tal_arrz(ctx, u8, num_pong_bytes); |
|
|
#if DEVELOPER |
|
|
#if DEVELOPER |
|
@ -49,8 +55,9 @@ u8 *make_ping(const tal_t *ctx, u16 num_pong_bytes, u16 padlen) |
|
|
{ |
|
|
{ |
|
|
/* BOLT #1:
|
|
|
/* BOLT #1:
|
|
|
* |
|
|
* |
|
|
* A node sending `pong` or `ping` SHOULD set `ignored` to zeroes, but |
|
|
* A node sending a `ping` message: |
|
|
* MUST NOT set `ignored` to sensitive data such as secrets, or |
|
|
* - SHOULD set `ignored` to 0s. |
|
|
|
|
|
* - MUST NOT set `ignored` to sensitive data such as secrets or |
|
|
* portions of initialized memory. |
|
|
* portions of initialized memory. |
|
|
*/ |
|
|
*/ |
|
|
u8 *ping, *ignored = tal_arrz(ctx, u8, padlen); |
|
|
u8 *ping, *ignored = tal_arrz(ctx, u8, padlen); |
|
|