Return headers list field from blockchain.block.headers#1296
Open
PeterXMR wants to merge 1 commit into
Open
Conversation
Electrum protocol v1.6 changes `blockchain.block.headers` to return headers as a list instead of a single concatenated hex string. This change emits the new `headers` array alongside the existing `hex` field so that v1.6 clients can consume the list form while older clients keep working. The legacy `hex` value is now derived from the list (concatenation) so the two are guaranteed consistent. The strict v1.6 reading is to drop `hex`; happy to do that in a follow-up coordinated with bumping `PROTOCOL_VERSION` to "1.6". Spec: https://electrum-protocol.readthedocs.io/en/latest/protocol-methods.html#blockchain-block-headers Refs romanz#1241
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.
Refs #1241 — checks off the
blockchain.block.headers"list instead of concatenated hex string" item on the v1.6 protocol checklist.Summary
Electrum protocol v1.6 changes
blockchain.block.headersto return headers as a list instead of a single concatenated hex string.This PR emits the new
headersarray alongside the existinghexfield, so v1.6 clients consume the list form while older clients keep working. Thehexvalue is now derived from the list (concatenation) so the two cannot drift apart.I went with additive (both fields) rather than the strict v1.6 reading (drop
hex). Reasoning:PROTOCOL_VERSION = "1.4"; droppinghexwhile claiming 1.4 would be a spec violation in the other directionPROTOCOL_VERSIONto"1.6"could drophexas part of that releaseHappy to flip to "drop
hex" if you'd prefer; it's a 2-line change.Test plan
cargo test --lib— 21/21 pass (the function is exercised indirectly through the dispatch path; behavior change is in JSON output shape only)cargo clippy --all-targets -- -D warnings— cleancargo fmt --check— cleanEach entry in
headersis a 80-byte (160-hex-char) block header;hexis their byte-for-byte concatenation (240 bytes / 480 hex chars for acount=3request).