-
Notifications
You must be signed in to change notification settings - Fork 35.7k
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
Don't pass nHashType down to script.h/.cpp #4555
Conversation
Untested ACK. I've always wondered what the nHashType flag was for, really... |
Removed nHashType from EvalScript and CheckSig as well. Maybe I can unify some of the commits (all of them?) |
@@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(script_valid) | |||
CScript scriptPubKey = ParseScript(scriptPubKeyString); | |||
|
|||
CTransaction tx; | |||
BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, tx, 0, flags, SIGHASH_NONE), strTest); |
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.
This was the only place where something different from 0 (SIGHASH_NONE = 2) was passed down, but the tests are running just fine without passing it.
@sipa nHashType is useful to determine what hash types are being used in scriptSigs; I'm actually working on a patch to eliminate a SIGHASH_ANYONECANPAY-related DoS attack that needs it. That said, it might be more useful to have a mechanism the hash types used are added to a list, or for that matter, a generic callback is called to let the callee apply whatever logic they need. |
@petertodd I'm not convinced that's currently a use case worth keeping the nHashType parameter for, especially as the implementation is not certain. |
@sipa Yeah, a sighash callback probably makes more sense and keeps more code out of the consensus critical section. So untested ACK. |
Tested ACK. Did a testnet sync from scratch with it (which likely has more cases of odd hashtypes than mainnet). |
|
Rebased on top of #4754 |
Rebased on top of #4755 |
Tested ACK |
Needs rebase (but a rebased version is in #4890). |
Rebased |
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4555_6dcfda2dc48bee2148acd571dce7d3f09608d7a2/ for binaries and test log. |
-Remove unused function main:VerifySignature (Class CScriptCheck is being used directly instead.)
-Remove CScriptCheck::nHashType (was always 0)