-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Script classification fixes #224
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
|
For easier eye-balling of the script test data, I've added |
|
+1 |
|
Added some amendments to |
|
I want to get one more +1 before pulling this. @abrkn @weilu @jprichardson |
src/scripts.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2nd argument false isn't used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers, will remove. It was an artifact of previous recursion protection.
On Jun 29, 2014 9:29 AM, "Wei Lu" notifications@github.com wrote:
In src/scripts.js:
this.chunks[1] === opcodes.OP_CHECKSIG}
-function isScripthash() {
- return this.chunks[this.chunks.length - 1] == opcodes.OP_EQUAL &&
- this.chunks[0] == opcodes.OP_HASH160 &&
+function isScriptHashInput() {- if (this.chunks.length < 2) return false
- var lastChunk = this.chunks[this.chunks.length - 1]
- if (!Buffer.isBuffer(lastChunk)) return false
- var scriptSig = Script.fromChunks(this.chunks.slice(0, -1))
- var scriptPubKey = Script.fromBuffer(lastChunk)
- return classifyInput(scriptSig, false) === classifyOutput(scriptPubKey)
2nd argument false isn't used.
—
Reply to this email directly or view it on GitHub
https://github.com/bitcoinjs/bitcoinjs-lib/pull/224/files#r14326810.
This pull request fixes the classification functions in
scriptsto only accept canonical signatures and public keys, as well as puts them under more strict testing.There isn't much testing for false positives, which is important to ensure does not occur, but we can add those cases as/if we get them.
A major point of annoyance was a triangular (circular) dependency issue formed by
scripts,AddressandECPubKey.The problem has been added as an inline comment in daa2cb7.