Repository navigation
Move p2p encodings from encode and into p2p - #4571
Merged
Merged
Conversation
In preparation to move `p2p` to its own crate, any `Vec<T>` that satisfies `T: Encodable` will not trivially implement `Encodable` because of the orphan rule. A type defined within p2p may implement `Encodable`, however, and the simplest possible type is one that simply wraps the vector. Three types that will implement `Encodable` within `p2p` are added here.
All of the `Encodable` implementations are defined within `p2p` with the exception of `p2p` types that are a `Vec`. To fully decouple `p2p` from `encode` we can define these in `p2p` like the others. This is the final step in removing anything `p2p` related from the rest of `bitcoin`.
Pull Request Test Coverage Report for Build 15277079593Details
💛 - Coveralls |
tcharding
approved these changes
May 30, 2025
p2p encodings from encode and into p2pp2p encodings from encode and into p2p
Member
|
Nice. Will ACK and merge. Hopefully we will be able to move encoding stuff into its own crate where we can expose the |
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.
To move
p2pinto a crate:Encodableimplementations forp2pmust be defined inp2p. To accomplish this, and anything else in the future related to encoding, I added adesermodule with the necessary macro to implementEncodableforVec<T> where T: Encodable.EncodableforVecwithinp2p, three types defined withinp2pare used to wrap theVecand snake around the orphan rule.