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

scriptHash.check should be agnostic of classification order #898

Merged
merged 6 commits into from
Sep 23, 2017
Merged

Conversation

dcousens
Copy link
Contributor

@dcousens dcousens commented Sep 22, 2017

Alternative to #897

Thanks and credit to @arik-so for reporting the bug, and providing a test case!

The issue is that classifications aren't unique and aren't guaranteed to be un-ambiguous.
scriptHash.check has assumed that through using classify* internally.

Instead, lets match 1 for 1, and if there is a double match, then we can say OK, it is probably script hash.

bscript.multisig.output.check(redeemScriptChunks)) return true

if (bscript.pubKey.input.check(scriptSigChunks) &&
bscript.pubKey.output.check(redeemScriptChunks)) return true
Copy link
Contributor Author

@dcousens dcousens Sep 22, 2017

Choose a reason for hiding this comment

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

this also stops recursive P2SH (but removing that wasn't necessary for the fix)

@dcousens
Copy link
Contributor Author

tests pass, @junderw / @afk11

@junderw
Copy link
Member

junderw commented Sep 22, 2017

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants