aboutsummaryrefslogtreecommitdiff
path: root/src/script.cpp
diff options
context:
space:
mode:
authorGavin Andresen <[email protected]>2013-01-23 07:08:55 -0800
committerGavin Andresen <[email protected]>2013-01-23 07:08:55 -0800
commitc429f2b062140843f42b78d70278279c6be74441 (patch)
tree9fafebf5a42b4aa4736fbc1b4cebdc5d5e87ed24 /src/script.cpp
parentMerge pull request #2167 from Diapolo/Qt_laa_flag (diff)
parentMake IsCanonicalScript() check the hash type more thoroughly (diff)
downloaddiscoin-c429f2b062140843f42b78d70278279c6be74441.tar.xz
discoin-c429f2b062140843f42b78d70278279c6be74441.zip
Merge pull request #2114 from sipa/strictstrict
Make IsCanonicalScript() check the hash type more thoroughly
Diffstat (limited to 'src/script.cpp')
-rw-r--r--src/script.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/script.cpp b/src/script.cpp
index 45ac8335d..5e5cd096c 100644
--- a/src/script.cpp
+++ b/src/script.cpp
@@ -278,7 +278,8 @@ bool IsCanonicalSignature(const valtype &vchSig) {
return error("Non-canonical signature: too short");
if (vchSig.size() > 73)
return error("Non-canonical signature: too long");
- if (vchSig[vchSig.size() - 1] & 0x7C)
+ unsigned char nHashType = vchSig[vchSig.size() - 1] & (~(SIGHASH_ANYONECANPAY));
+ if (nHashType < SIGHASH_ALL || nHashType > SIGHASH_SINGLE)
return error("Non-canonical signature: unknown hashtype byte");
if (vchSig[0] != 0x30)
return error("Non-canonical signature: wrong type");