fix: add backward compat for DlcOffer without protocol_version#238
Merged
matthewjablack merged 1 commit intoJun 27, 2026
Merged
Conversation
Re-introduces the heuristic for detecting old-format DlcOffer messages that lack the protocol_version field (pre-dlcspecs PR #163). The previous heuristic (removed in #237) incorrectly required contract_flags === 0, which broke when contract_flags is 0x01 (refund-to-accepter). This version only checks whether the first 4 bytes are a plausible protocol_version (1-10), matching the Rust implementation in dlcdevkit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-introduces backward compatibility for deserializing old-format DlcOffer messages that lack the
protocol_versionfield (pre-dlcspecs PR #163).The previous heuristic (removed in #237) incorrectly required
contract_flags === 0, which broke whencontract_flagsis0x01(refund-to-accepter). This version only checks whether the first 4 bytes are a plausibleprotocol_version(1-10), matching the Rust implementation in dlcdevkit PR #165.Changes
protocol_version; otherwise treat as old format (defaultprotocolVersion = 1)contract_flagsis read unconditionally in both paths, supporting any value including0x01All 419 existing tests pass, including cross-language compatibility tests against Rust-DLC test vectors.