Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve leaf errors #2530

Merged
merged 3 commits into from Mar 13, 2024
Merged

Conversation

tcharding
Copy link
Member

In light of recent discussion go over the codebase and look for some places that the leaf errors are wrong. Does not do the whole code base, excludes p2p and a couple of other places.

@github-actions github-actions bot added C-bitcoin PRs modifying the bitcoin crate C-hashes PRs modifying the hashes crate labels Mar 1, 2024
apoelstra
apoelstra previously approved these changes Mar 2, 2024
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK da98a84 I kinda think invalid() should have a better name but I am not sure what

@tcharding
Copy link
Member Author

I'm guessing a better naming convention will fall out once I've done this a few more times. I"m was leaning towards making the names a bit longer than usual but @Kixunil suggested shortening one recently. Not totally sure either way. Shall we merge and iterate?

@coveralls
Copy link

coveralls commented Mar 4, 2024

Pull Request Test Coverage Report for Build 8242086240

Details

  • 0 of 4 (0.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.01%) to 84.057%

Changes Missing Coverage Covered Lines Changed/Added Lines %
bitcoin/src/blockdata/script/witness_version.rs 0 2 0.0%
hashes/src/lib.rs 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
bitcoin/src/blockdata/script/witness_version.rs 1 30.77%
Totals Coverage Status
Change from base Build 8239659179: 0.01%
Covered Lines: 19540
Relevant Lines: 23246

💛 - Coveralls


impl TryFromError {
/// Returns the invalid non-witness version integer.
pub fn invalid(&self) -> u8 { self.invalid }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is too confusing I think. I'd prefer provided_version or something along those lines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used invalid_version.

bitcoin/src/pow.rs Show resolved Hide resolved
Leaf error types should typically have private fields, provide accessor
functions, and not use `non_exhaustive`.
Leaf error types should typically have private fields, provide accessor
functions, and not use `non_exhaustive`.
Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Waiting for the resolution on the necessity of last commit.

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK f8de795

Copy link
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK f8de795

@apoelstra apoelstra merged commit d2617f9 into rust-bitcoin:master Mar 13, 2024
187 checks passed
@tcharding tcharding deleted the 03-01-leaf-errors branch March 14, 2024 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bitcoin PRs modifying the bitcoin crate C-hashes PRs modifying the hashes crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants