Skip to content

Drop BufReader in Deserialization of Consensus Objects#4743

Merged
valentinewallace merged 2 commits into
lightningdevkit:mainfrom
Abeeujah:drop-bufread
Jun 24, 2026
Merged

Drop BufReader in Deserialization of Consensus Objects#4743
valentinewallace merged 2 commits into
lightningdevkit:mainfrom
Abeeujah:drop-bufread

Conversation

@Abeeujah

@Abeeujah Abeeujah commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

The rust-bitcoin 0.32.4 release include the standardisation of deserialization methods to use Read over BufRead when decoding/deserializing consensus objects, this makes the buffered Read wrapper no longer needed and can now be dropped.

  • deee085 Drops the usage of BufReader in Readable impl.
  • b582ce1 Drops the buffered Read wrapper.

Abeeujah added 2 commits June 24, 2026 15:06
The BufReader wrapping is no longer needed after the rust-bitcoin
`0.32.4` release which contains the standardisation of the trait
bounds for deserialization to `Read` instead of `BufReader`.
Post `0.32.4` deserialization of consensus objects now use `Read`
as the trait bounds, making the BufReader no longer needed for
deserialization.
@ldk-reviews-bot

ldk-reviews-bot commented Jun 24, 2026

Copy link
Copy Markdown

I've assigned @valentinewallace as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-claude-review-bot

Copy link
Copy Markdown
Collaborator

The PR is small and surgical. Let me verify the change preserves the original "don't over-read" property and that the dependency supports the new API.

The Cargo.toml already requires bitcoin = "0.32.4" (lightning/Cargo.toml:42), which guarantees the Read-based consensus_decode API. The removed BufReader was, in normal operation, a pass-through (its fill_buf/consume were never called by rust-bitcoin, hence the debug_assert!(false)), and its read simply delegated to the inner reader. Passing r directly to the new Read-based decoder preserves the same byte-exact, no-over-read behavior. The use import correctly retains self/Read/Write, all of which are still used. No remaining references to BufReader/BufRead exist in ser.rs.

No issues found.

@ldk-reviews-bot

Copy link
Copy Markdown

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@valentinewallace valentinewallace merged commit ad132ea into lightningdevkit:main Jun 24, 2026
17 of 19 checks passed
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.

4 participants