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
BOLTDIR := ../bolts/
DEFAULT_BOLTVERSION := e60d594abf436e768116684080997a8d4f960263
DEFAULT_BOLTVERSION := c1b94dfad12d9e29268cbd0d3b22686ea5709cbc
# Can be overridden on cmdline.
BOLTVERSION := $(DEFAULT_BOLTVERSION)

View File

@@ -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);

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);
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;

View File

@@ -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<sup>[1](#reference-1)</sup>
* * `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);

View File

@@ -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);

View File

@@ -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

View File

@@ -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 {

View File

@@ -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]);

View File

@@ -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;