mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
BOLT: update bolt quotes now that TLVs are not experimental.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -17,7 +17,7 @@ const void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_fail called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
*
|
||||
* A correct implementation should pass against these test vectors:
|
||||
* ```json
|
||||
@@ -155,7 +155,7 @@ static void test_decode(const char *json, const jsmntok_t toks[])
|
||||
}
|
||||
}
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
*
|
||||
* A correct implementation should pass against the following test vectors:
|
||||
* ```json
|
||||
|
||||
@@ -101,7 +101,7 @@ static u64 fromwire_tlv_uint(const u8 **cursor, size_t *max, size_t maxlen)
|
||||
|
||||
assert(maxlen <= sizeof(bytes));
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
*
|
||||
* - if `length` is not exactly equal to that required for the
|
||||
* known encoding for `type`:
|
||||
@@ -117,7 +117,7 @@ static u64 fromwire_tlv_uint(const u8 **cursor, size_t *max, size_t maxlen)
|
||||
memset(bytes, 0, sizeof(bytes));
|
||||
fromwire(cursor, max, bytes + sizeof(bytes) - length, length);
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
* - if variable-length fields within the known encoding for `type` are
|
||||
* not minimal:
|
||||
* - MUST fail to parse the `tlv_stream`.
|
||||
|
||||
@@ -91,7 +91,7 @@ static struct invalid_stream invalid_streams_either[] = {
|
||||
{ "ff0100000000000002 00", "unknown even type." },
|
||||
};
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
*
|
||||
* The following TLV streams in namespace `n1` should trigger a decoding
|
||||
failure:
|
||||
@@ -180,7 +180,7 @@ static struct invalid_stream invalid_streams_n1[] = {
|
||||
{ "00 00", "unknown even field for `n1`s namespace." },
|
||||
};
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
### TLV Stream Decoding Failure
|
||||
|
||||
Any appending of an invalid stream to a valid stream should trigger
|
||||
@@ -193,16 +193,16 @@ In addition, the following TLV streams in namespace `n1` should
|
||||
trigger a decoding failure:
|
||||
|
||||
1. Invalid stream: 0x02 08 0000000000000226 01 01 2a
|
||||
2. Reason: valid tlv records but invalid ordering
|
||||
2. Reason: valid TLV records but invalid ordering
|
||||
|
||||
1. Invalid stream: 0x02 08 0000000000000231 02 08 0000000000000451
|
||||
2. Reason: duplicate tlv type
|
||||
2. Reason: duplicate TLV type
|
||||
|
||||
1. Invalid stream: 0x1f 00 0f 01 2a
|
||||
2. Reason: valid (ignored) tlv records but invalid ordering
|
||||
2. Reason: valid (ignored) TLV records but invalid ordering
|
||||
|
||||
1. Invalid stream: 0x1f 00 1f 01 2a
|
||||
2. Reason: duplicate tlv type (ignored)
|
||||
2. Reason: duplicate TLV type (ignored)
|
||||
*/
|
||||
static struct invalid_stream invalid_streams_n1_combo[] = {
|
||||
{ "02 08 0000000000000226 01 01 2a", "valid tlv records but invalid ordering" },
|
||||
@@ -211,18 +211,18 @@ static struct invalid_stream invalid_streams_n1_combo[] = {
|
||||
{ "1f 00 1f 01 2a", "duplicate tlv type (ignored)" }
|
||||
};
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
The following TLV stream in namespace `n2` should trigger a decoding
|
||||
failure:
|
||||
|
||||
1. Invalid stream: 0xffffffffffffffffff 00 00 00
|
||||
2. Reason: valid tlv records but invalid ordering
|
||||
2. Reason: valid TLV records but invalid ordering
|
||||
*/
|
||||
static struct invalid_stream invalid_streams_n2_combo[] = {
|
||||
{ "ffffffffffffffffff 00 00 00", "valid tlv records but invalid ordering" },
|
||||
{ "ffffffffffffffffff 00 00 00", "valid TLV records but invalid ordering" },
|
||||
};
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
*
|
||||
### TLV Decoding Successes
|
||||
|
||||
@@ -534,7 +534,7 @@ int main(void)
|
||||
assert(memeq(p2, tal_count(p2), orig_p, tal_count(orig_p)));
|
||||
}
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
*
|
||||
* Any appending of an invalid stream to a valid stream should trigger
|
||||
* a decoding failure.
|
||||
@@ -596,7 +596,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
*
|
||||
* Any appending of a higher-numbered valid stream to a lower-numbered
|
||||
* valid stream should not trigger a decoding failure.
|
||||
|
||||
@@ -27,7 +27,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
|
||||
/* prev_type points to prev_type_store after first iter. */
|
||||
u64 prev_type_store, *prev_type = NULL;
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
*
|
||||
* The receiving node:
|
||||
* - if zero bytes remain before parsing a `type`:
|
||||
@@ -37,7 +37,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
|
||||
u64 type, length;
|
||||
const struct tlv_record_type *rtype;
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
*
|
||||
* A `varint` is a variable-length, unsigned integer encoding
|
||||
* using the [BigSize](#appendix-a-bigsize-test-vectors)
|
||||
@@ -45,7 +45,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
|
||||
*/
|
||||
type = fromwire_bigsize(cursor, max);
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
* - if a `type` or `length` is not minimally encoded:
|
||||
* - MUST fail to parse the `tlv_stream`.
|
||||
*/
|
||||
@@ -55,7 +55,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
|
||||
}
|
||||
length = fromwire_bigsize(cursor, max);
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
* - if a `type` or `length` is not minimally encoded:
|
||||
* - MUST fail to parse the `tlv_stream`.
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
* - if `length` exceeds the number of bytes remaining in the
|
||||
* message:
|
||||
* - MUST fail to parse the `tlv_stream`.
|
||||
@@ -74,7 +74,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
* - if decoded `type`s are not monotonically-increasing:
|
||||
* - MUST fail to parse the `tlv_stream`.
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
* - if `type` is known:
|
||||
* - MUST decode the next `length` bytes using the known
|
||||
* encoding for `type`.
|
||||
@@ -100,7 +100,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
|
||||
if (!*cursor)
|
||||
goto fail;
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
* - if `length` is not exactly equal to that required
|
||||
* for the known encoding for `type`:
|
||||
* - MUST fail to parse the `tlv_stream`.
|
||||
@@ -113,7 +113,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
|
||||
/* We've read bytes in ->fromwire, so update max */
|
||||
*max -= length;
|
||||
} else {
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
* - otherwise, if `type` is unknown:
|
||||
* - if `type` is even:
|
||||
* - MUST fail to parse the `tlv_stream`.
|
||||
@@ -154,7 +154,7 @@ void towire_tlvs(u8 **pptr,
|
||||
if (!val)
|
||||
continue;
|
||||
|
||||
/* BOLT-EXPERIMENTAL #1:
|
||||
/* BOLT #1:
|
||||
*
|
||||
* The sending node:
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user