Repository navigation
Add index and sighash check when control block given - #53
Open
stringhandler wants to merge 2 commits into
Open
stringhandler wants to merge 2 commits into
stringhandler wants to merge 2 commits into
Conversation
apoelstra
reviewed
Oct 22, 2026
| }; | ||
| let input_idx: u32 = input_idx.parse().map_err(SimplicitySighashError::InputIndexParsing)?; | ||
| // Checked here because the PSET input lookup below is skipped when a control block is given. | ||
| if input_idx as usize >= tx.input.len() { |
Contributor
There was a problem hiding this comment.
In 6627744:
This loses the "probably fine" comment on the cast. But we should probably just get rid of the cast and use try_from to convert the u32 to usize. If the try_from fails we can return InputIndexOutOfRange.
Also, rather than doing an explicit check like this then having a panicking [] below, we should just use get here even though the actual input is unused when a control block is given.
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.
Add two extra checks, specifically picked up by AI scans. These are likely low priority, but I'm fixing them here so that they don't show up again.
They are both related to a control block being passed in. One checks for input indexes, that was skipped before hand and the other checks that the control block matches what is being signed.