8000 psbt: Add IndexOutOfBounds error by tcharding · Pull Request #2004 · rust-bitcoin/rust-bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

psbt: Add IndexOutOfBounds error #2004

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

Conversation

tcharding
Copy link
Member
@tcharding tcharding commented Aug 17, 2023

We currently have a bunch of functions that are infallible if the index argument is within-bounds however we return a SignError, this obfuscates the code.

Add an IndexOutOfBoundsError. While we are at it make it an enum so users can differentiate between which vector the out of bounds access was attempted against.

@tcharding tcharding marked this pull request as draft August 17, 2023 21:35
We currently have a bunch of functions that are infallible if the
`index` argument is within-bounds however we return a `SignError`, this
obfuscates the code.

Add an `IndexOutOfBoundsErorr`. While we are at it make it an enum so
users can differentiate between which vector the out of bounds access
was attempted against.
@tcharding tcharding force-pushed the 08-17-sighash-input-out-of-bounds-error branch from 427460b to 66d5800 Compare August 24, 2023 02:12
@tcharding tcharding marked this pull request as ready for review August 24, 2023 02:12
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.

utACK 66d5800. This is a clean improvement over existing code.

@apoelstra
Copy link
Member

I think we could use this for some of the sighash methods as well.

@tcharding
Copy link
Member Author
tcharding commented Aug 24, 2023

Yeah I had the same idea yesterday, but this error type is tied to PSBT. It could be changed but since its basically all boilerplate code I rekon its better to just add another version of this error to the sighash module. Anyways, the sighash error fixes are not as straight forward as others.

@apoelstra
Copy link
Member

Hmm, ok. Then this is fine for now.

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 66d5800

@apoelstra apoelstra merged commit a458461 into rust-bitcoin:master Aug 25, 2023
@tcharding tcharding deleted the 08-17-sighash-input-out-of-bounds-error branch May 22, 2024 23:13
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.

3 participants
0