mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
gossipd: use default zlib compression, hack for zlib expansion.
These both allow us to reproduce the test vectors in the next patch. But using Z_DEFAULT_COMPRESSION is a reasonable idea anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
f6cf4bf62a
commit
4de47f6db5
@ -327,9 +327,13 @@ static u8 *zencode(const tal_t *ctx, const u8 *scids, size_t len)
|
|||||||
int err;
|
int err;
|
||||||
unsigned long compressed_len = len;
|
unsigned long compressed_len = len;
|
||||||
|
|
||||||
|
#ifdef ZLIB_EVEN_IF_EXPANDS
|
||||||
|
/* Needed for test vectors */
|
||||||
|
compressed_len = 128 * 1024;
|
||||||
|
#endif
|
||||||
/* Prefer to fail if zlib makes it larger */
|
/* Prefer to fail if zlib makes it larger */
|
||||||
z = tal_arr(ctx, u8, len);
|
z = tal_arr(ctx, u8, compressed_len);
|
||||||
err = compress2(z, &compressed_len, scids, len, Z_BEST_COMPRESSION);
|
err = compress2(z, &compressed_len, scids, len, Z_DEFAULT_COMPRESSION);
|
||||||
if (err == Z_OK) {
|
if (err == Z_OK) {
|
||||||
status_trace("compressed %zu into %lu",
|
status_trace("compressed %zu into %lu",
|
||||||
len, compressed_len);
|
len, compressed_len);
|
||||||
|
Loading…
Reference in New Issue
Block a user