Makefile: update to BOLTs without zlib.

This contains a typo fix and a clarification on channel_type, but also
removes ZLIB.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-05-18 10:28:58 +09:30
parent a4c365f8d0
commit bf040c398b
9 changed files with 15 additions and 17 deletions

View File

@@ -21,7 +21,7 @@ CCANDIR := ccan
# Where we keep the BOLT RFCs # Where we keep the BOLT RFCs
BOLTDIR := ../bolts/ BOLTDIR := ../bolts/
DEFAULT_BOLTVERSION := e60d594abf436e768116684080997a8d4f960263 DEFAULT_BOLTVERSION := c1b94dfad12d9e29268cbd0d3b22686ea5709cbc
# Can be overridden on cmdline. # Can be overridden on cmdline.
BOLTVERSION := $(DEFAULT_BOLTVERSION) BOLTVERSION := $(DEFAULT_BOLTVERSION)

View File

@@ -379,7 +379,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
/* BOLT #3: /* BOLT #3:
* *
* 9. Sort the outputs into [BIP 69+CLTV * 9. Sort the outputs into [BIP 69+CLTV
* order](#transaction-input-and-output-ordering) * order](#transaction-output-ordering)
*/ */
permute_outputs(tx, cltvs, (const void **)*htlcmap); permute_outputs(tx, cltvs, (const void **)*htlcmap);

View File

@@ -42,7 +42,7 @@ struct short_channel_id *decode_short_ids(const tal_t *ctx, const u8 *encoded)
*/ */
type = fromwire_u8(&encoded, &max); type = fromwire_u8(&encoded, &max);
switch (type) { switch (type) {
case ARR_ZLIB: case ARR_ZLIB_DEPRECATED:
encoded = unzlib(tmpctx, encoded, max); encoded = unzlib(tmpctx, encoded, max);
if (!encoded) if (!encoded)
return NULL; return NULL;
@@ -85,7 +85,7 @@ bigsize_t *decode_scid_query_flags(const tal_t *ctx,
* - MAY close the connection. * - MAY close the connection.
*/ */
switch (qf->encoding_type) { switch (qf->encoding_type) {
case ARR_ZLIB: case ARR_ZLIB_DEPRECATED:
encoded = unzlib(tmpctx, encoded, max); encoded = unzlib(tmpctx, encoded, max);
if (!encoded) if (!encoded)
return NULL; return NULL;
@@ -119,7 +119,7 @@ decode_channel_update_timestamps(const tal_t *ctx,
/* FIXME: BOLT #7 should have a requirements like it does for /* FIXME: BOLT #7 should have a requirements like it does for
* query_short_channel_ids_tlvs! */ * query_short_channel_ids_tlvs! */
switch (timestamps_tlv->encoding_type) { switch (timestamps_tlv->encoding_type) {
case ARR_ZLIB: case ARR_ZLIB_DEPRECATED:
encoded = unzlib(tmpctx, encoded, max); encoded = unzlib(tmpctx, encoded, max);
if (!encoded) if (!encoded)
return NULL; return NULL;

View File

@@ -11,11 +11,11 @@ struct tlv_reply_channel_range_tlvs_timestamps_tlv;
* *
* Encoding types: * Encoding types:
* * `0`: uncompressed array of `short_channel_id` types, in ascending order. * * `0`: uncompressed array of `short_channel_id` types, in ascending order.
* * `1`: array of `short_channel_id` types, in ascending order, compressed with zlib deflate<sup>[1](#reference-1)</sup> * * `1`: Previously used for zlib compression, this encoding MUST NOT be used.
*/ */
enum arr_encode_types { enum arr_encode_types {
ARR_UNCOMPRESSED = 0, ARR_UNCOMPRESSED = 0,
ARR_ZLIB = 1 ARR_ZLIB_DEPRECATED = 1
}; };
struct short_channel_id *decode_short_ids(const tal_t *ctx, const u8 *encoded); struct short_channel_id *decode_short_ids(const tal_t *ctx, const u8 *encoded);

View File

@@ -291,7 +291,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
/* BOLT #3: /* BOLT #3:
* *
* 9. Sort the outputs into [BIP 69+CLTV * 9. Sort the outputs into [BIP 69+CLTV
* order](#transaction-input-and-output-ordering) * order](#transaction-output-ordering)
*/ */
permute_outputs(tx, NULL, output_order); permute_outputs(tx, NULL, output_order);

View File

@@ -42,7 +42,7 @@ int main(int argc, char *argv[])
if (encoding == ARR_UNCOMPRESSED) if (encoding == ARR_UNCOMPRESSED)
printf("%02x%s\n", encoding, tal_hex(NULL, data)); printf("%02x%s\n", encoding, tal_hex(NULL, data));
else if (encoding == ARR_ZLIB) { else if (encoding == ARR_ZLIB_DEPRECATED) {
/* https://www.zlib.net/zlib_tech.html: /* https://www.zlib.net/zlib_tech.html:
* the only expansion is an overhead of five bytes per 16 KB * the only expansion is an overhead of five bytes per 16 KB
* block (about 0.03%), plus a one-time overhead of six bytes * block (about 0.03%), plus a one-time overhead of six bytes

View File

@@ -189,7 +189,7 @@ static bool printwire_encoded_short_ids(const u8 **cursor, size_t *plen, size_t
case ARR_UNCOMPRESSED: case ARR_UNCOMPRESSED:
printf(" (UNCOMPRESSED)"); printf(" (UNCOMPRESSED)");
break; break;
case ARR_ZLIB: case ARR_ZLIB_DEPRECATED:
printf(" (ZLIB)"); printf(" (ZLIB)");
break; break;
default: default:
@@ -202,7 +202,7 @@ static bool printwire_encoded_short_ids(const u8 **cursor, size_t *plen, size_t
/* If it was unknown, that's different from corrupt */ /* If it was unknown, that's different from corrupt */
if (len == 0 if (len == 0
|| arr[0] == ARR_UNCOMPRESSED || arr[0] == ARR_UNCOMPRESSED
|| arr[0] == ARR_ZLIB) { || arr[0] == ARR_ZLIB_DEPRECATED) {
printf(" **CORRUPT**"); printf(" **CORRUPT**");
return true; return true;
} else { } else {

View File

@@ -23,9 +23,8 @@ static u32 dev_max_encoding_bytes = -1U;
/* BOLT #7: /* BOLT #7:
* *
* There are several messages which contain a long array of * There are several messages which contain a long array of
* `short_channel_id`s (called `encoded_short_ids`) so we utilize a * `short_channel_id`s (called `encoded_short_ids`) so we include an encoding
* simple compression scheme: the first byte indicates the encoding, the * byte which allows for different encoding schemes to be defined in the future
* rest contains the data.
*/ */
static u8 *encoding_start(const tal_t *ctx, bool prepend_encoding) static u8 *encoding_start(const tal_t *ctx, bool prepend_encoding)
{ {
@@ -117,7 +116,6 @@ bool query_short_channel_ids(struct daemon *daemon,
* Encoding types: * Encoding types:
* * `0`: uncompressed array of `short_channel_id` types, in * * `0`: uncompressed array of `short_channel_id` types, in
* ascending order. * ascending order.
* * `1`: array of `short_channel_id` types, in ascending order
*/ */
assert(i == 0 || scids[i].u64 > scids[i-1].u64); assert(i == 0 || scids[i].u64 > scids[i-1].u64);
encoding_add_short_channel_id(&encoded, &scids[i]); encoding_add_short_channel_id(&encoded, &scids[i]);

View File

@@ -1000,8 +1000,8 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
accept_tlvs->upfront_shutdown_script accept_tlvs->upfront_shutdown_script
= state->upfront_shutdown_script[LOCAL]; = state->upfront_shutdown_script[LOCAL];
/* BOLT #2: /* BOLT #2:
* - if it sets `channel_type`: * - if `option_channel_type` was negotiated:
* - MUST set it to the `channel_type` from `open_channel` * - MUST set `channel_type` to the `channel_type` from `open_channel`
*/ */
accept_tlvs->channel_type = state->channel_type->features; accept_tlvs->channel_type = state->channel_type->features;