1
0

lnpeer: remove support for zlib compression

Must not be used anymore according to bolt 7:
0cf21511a7/07-routing-gossip.md (L600)
This commit is contained in:
f321x
2025-12-11 15:07:21 +01:00
parent 0eefcbae9c
commit 380d7edea2

View File

@@ -4,7 +4,6 @@
# Distributed under the MIT software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php # file LICENCE or http://www.opensource.org/licenses/mit-license.php
import zlib
from collections import OrderedDict, defaultdict from collections import OrderedDict, defaultdict
import asyncio import asyncio
import os import os
@@ -786,13 +785,11 @@ class Peer(Logger, EventListener):
first_blocknum=first_block, first_blocknum=first_block,
number_of_blocks=num_blocks) number_of_blocks=num_blocks)
def decode_short_ids(self, encoded): @staticmethod
if encoded[0] == 0: def decode_short_ids(encoded):
decoded = encoded[1:] if encoded[0] != 0:
elif encoded[0] == 1:
decoded = zlib.decompress(encoded[1:])
else:
raise Exception(f'decode_short_ids: unexpected first byte: {encoded[0]}') raise Exception(f'decode_short_ids: unexpected first byte: {encoded[0]}')
decoded = encoded[1:]
ids = [decoded[i:i+8] for i in range(0, len(decoded), 8)] ids = [decoded[i:i+8] for i in range(0, len(decoded), 8)]
return ids return ids