Skip to content

Cleanup syncer encodingtype - #11036

Draft
TechLateef wants to merge 4 commits into
lightningnetwork:masterfrom
TechLateef:cleanup-syncer-encodingtype
Draft

Cleanup syncer encodingtype#11036
TechLateef wants to merge 4 commits into
lightningnetwork:masterfrom
TechLateef:cleanup-syncer-encodingtype

Conversation

@TechLateef

@TechLateef TechLateef commented Aug 6, 2026

Copy link
Copy Markdown

Change Description

This PR is a follow-up to PR #10980.

With zlib compression for gossip queries dropped and lnd exclusively using EncodingSortedPlain,
several pieces of syncer configuration that existed solely to select between plain and zlib encodings are
now redundant.

Changes

  • Removed the encodingType field from gossipSyncerCfg.
  • Replaced the single-entry encodingTypeToChunkSize map with the defaultChunkSize = 8000 constant
    in discovery/syncer.go.
  • Removed the single-arm switch g.cfg.encodingType block in processChanRangeReply.
  • Explicitly set EncodingType: lnwire.EncodingSortedPlain on outgoing ReplyChannelRange messages,
    aligning with QueryShortChanIDs.
  • Cleaned up SyncManager and test helpers across syncer_test.go, syncer_atomic_test.go, and
    syncer_queue_test.go.

Related PRs

This commit removes support for the deprecated EncodingSortedZlib
format (type 1) which was dropped from the BOLT 7 specification.
All zlib compression and decompression logic has been removed from
lnwire messages. The EncodingSortedZlib constant is now marked as
Deprecated to retain protocol documentation. The decode path now
explicitly returns an error when a peer attempts to send zlib-encoded
data, rather than a generic unknown encoding error. All tests that
previously verified zlib scenarios have been cleaned up or deleted.
This removal is safe because lnd has never sent zlib-encoded data,
and nobody on the network sends type 1.
Additionally, dropping this encoding removes the package-global
zlibDecodeMtx, improving performance and security without introducing
new DoS vectors, as receiving type 1 now simply triggers an instant
disconnect.
This commit removes zlib-specific chunking logic from the discovery
syncer. Since LND no longer supports zlib compression for gossip
queries, the corresponding chunking factors and parsing cases in the
syncer are no longer needed.
Now that zlib compression for gossip queries has been removed and
lnd only produces plain encoding (EncodingSortedPlain), the
encodingType field in gossipSyncerCfg, the single-entry
encodingTypeToChunkSize map, and the single-arm switch in syncer.go
are redundant.

This commit cleans up the syncer configuration by removing the
encodingType field and replacing encodingTypeToChunkSize with the
defaultChunkSize constant. Outgoing QueryShortChanIDs and
ReplyChannelRange messages now directly specify EncodingSortedPlain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant