consensus_encoding: remove Transitioning state#5130
Merged
apoelstra merged 1 commit intorust-bitcoin:masterfrom Oct 14, 2025
Merged
consensus_encoding: remove Transitioning state#5130apoelstra merged 1 commit intorust-bitcoin:masterfrom
apoelstra merged 1 commit intorust-bitcoin:masterfrom
Conversation
apoelstra
reviewed
Oct 13, 2025
| // remains in an Errored state. | ||
| match mem::replace(&mut self.state, Decoder2State::Errored) { | ||
| Decoder2State::First(first, second) => { | ||
| let first_result = first.end().map_err(Err::from)?; |
apoelstra
reviewed
Oct 13, 2025
| } | ||
| E::UnexpectedEof { required, received: 0 } => { | ||
| write!(f, "required at least {} bytes but the input is empty", required) | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Oops, yes, I just ran the fmt on the crate out of habit and missed this change.
Simplify the Decoder2State by dropping the unnecessary Transitioning variant. We can just use the Errored variant and not change the state of the Decoder2 if the first decoder fails while transitioning to the second.
eb77b0d to
144adfc
Compare
Contributor
Author
|
144adfc: dropped unnecessary |
tcharding
approved these changes
Oct 14, 2025
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.
Inspired by cleanup in #5129, simplify the
Decoder2Stateby dropping the unnecessary Transitioning variant. We can just use theErroredvariant and not change the state of theDecoder2if the first decoder fails while transitioning to the second.