From bf040c398b1dc6c42c9b3df3ac74bb786db56a99 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 18 May 2022 10:28:58 +0930 Subject: [PATCH] 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 --- Makefile | 2 +- channeld/commit_tx.c | 2 +- common/decode_array.c | 6 +++--- common/decode_array.h | 4 ++-- common/initial_commit_tx.c | 2 +- devtools/mkencoded.c | 2 +- devtools/print_wire.c | 4 ++-- gossipd/queries.c | 6 ++---- openingd/openingd.c | 4 ++-- 9 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index e69e85435..70975595b 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ CCANDIR := ccan # Where we keep the BOLT RFCs BOLTDIR := ../bolts/ -DEFAULT_BOLTVERSION := e60d594abf436e768116684080997a8d4f960263 +DEFAULT_BOLTVERSION := c1b94dfad12d9e29268cbd0d3b22686ea5709cbc # Can be overridden on cmdline. BOLTVERSION := $(DEFAULT_BOLTVERSION) diff --git a/channeld/commit_tx.c b/channeld/commit_tx.c index 2fdf0df1a..b1f0ae51f 100644 --- a/channeld/commit_tx.c +++ b/channeld/commit_tx.c @@ -379,7 +379,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx, /* BOLT #3: * * 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); diff --git a/common/decode_array.c b/common/decode_array.c index 7296d072a..157eea48d 100644 --- a/common/decode_array.c +++ b/common/decode_array.c @@ -42,7 +42,7 @@ struct short_channel_id *decode_short_ids(const tal_t *ctx, const u8 *encoded) */ type = fromwire_u8(&encoded, &max); switch (type) { - case ARR_ZLIB: + case ARR_ZLIB_DEPRECATED: encoded = unzlib(tmpctx, encoded, max); if (!encoded) return NULL; @@ -85,7 +85,7 @@ bigsize_t *decode_scid_query_flags(const tal_t *ctx, * - MAY close the connection. */ switch (qf->encoding_type) { - case ARR_ZLIB: + case ARR_ZLIB_DEPRECATED: encoded = unzlib(tmpctx, encoded, max); if (!encoded) 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 * query_short_channel_ids_tlvs! */ switch (timestamps_tlv->encoding_type) { - case ARR_ZLIB: + case ARR_ZLIB_DEPRECATED: encoded = unzlib(tmpctx, encoded, max); if (!encoded) return NULL; diff --git a/common/decode_array.h b/common/decode_array.h index c1f09c4bf..697e8ddee 100644 --- a/common/decode_array.h +++ b/common/decode_array.h @@ -11,11 +11,11 @@ struct tlv_reply_channel_range_tlvs_timestamps_tlv; * * Encoding types: * * `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[1](#reference-1) + * * `1`: Previously used for zlib compression, this encoding MUST NOT be used. */ enum arr_encode_types { ARR_UNCOMPRESSED = 0, - ARR_ZLIB = 1 + ARR_ZLIB_DEPRECATED = 1 }; struct short_channel_id *decode_short_ids(const tal_t *ctx, const u8 *encoded); diff --git a/common/initial_commit_tx.c b/common/initial_commit_tx.c index 44203f7f4..1c319ceb1 100644 --- a/common/initial_commit_tx.c +++ b/common/initial_commit_tx.c @@ -291,7 +291,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx, /* BOLT #3: * * 9. Sort the outputs into [BIP 69+CLTV - * order](#transaction-input-and-output-ordering) + * order](#transaction-output-ordering) */ permute_outputs(tx, NULL, output_order); diff --git a/devtools/mkencoded.c b/devtools/mkencoded.c index f76d2ab81..76a2bc20a 100644 --- a/devtools/mkencoded.c +++ b/devtools/mkencoded.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) if (encoding == ARR_UNCOMPRESSED) 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: * the only expansion is an overhead of five bytes per 16 KB * block (about 0.03%), plus a one-time overhead of six bytes diff --git a/devtools/print_wire.c b/devtools/print_wire.c index f8b4acc1f..742b72de6 100644 --- a/devtools/print_wire.c +++ b/devtools/print_wire.c @@ -189,7 +189,7 @@ static bool printwire_encoded_short_ids(const u8 **cursor, size_t *plen, size_t case ARR_UNCOMPRESSED: printf(" (UNCOMPRESSED)"); break; - case ARR_ZLIB: + case ARR_ZLIB_DEPRECATED: printf(" (ZLIB)"); break; 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 (len == 0 || arr[0] == ARR_UNCOMPRESSED - || arr[0] == ARR_ZLIB) { + || arr[0] == ARR_ZLIB_DEPRECATED) { printf(" **CORRUPT**"); return true; } else { diff --git a/gossipd/queries.c b/gossipd/queries.c index a1ec4dcff..cb5a61d11 100644 --- a/gossipd/queries.c +++ b/gossipd/queries.c @@ -23,9 +23,8 @@ static u32 dev_max_encoding_bytes = -1U; /* BOLT #7: * * There are several messages which contain a long array of - * `short_channel_id`s (called `encoded_short_ids`) so we utilize a - * simple compression scheme: the first byte indicates the encoding, the - * rest contains the data. + * `short_channel_id`s (called `encoded_short_ids`) so we include an encoding + * byte which allows for different encoding schemes to be defined in the future */ 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: * * `0`: uncompressed array of `short_channel_id` types, in * ascending order. - * * `1`: array of `short_channel_id` types, in ascending order */ assert(i == 0 || scids[i].u64 > scids[i-1].u64); encoding_add_short_channel_id(&encoded, &scids[i]); diff --git a/openingd/openingd.c b/openingd/openingd.c index 5a83ae1c1..b929a998f 100644 --- a/openingd/openingd.c +++ b/openingd/openingd.c @@ -1000,8 +1000,8 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg) accept_tlvs->upfront_shutdown_script = state->upfront_shutdown_script[LOCAL]; /* BOLT #2: - * - if it sets `channel_type`: - * - MUST set it to the `channel_type` from `open_channel` + * - if `option_channel_type` was negotiated: + * - MUST set `channel_type` to the `channel_type` from `open_channel` */ accept_tlvs->channel_type = state->channel_type->features;