diff options
| author | Gavin Andresen <[email protected]> | 2013-01-23 07:08:55 -0800 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2013-01-23 07:08:55 -0800 |
| commit | c429f2b062140843f42b78d70278279c6be74441 (patch) | |
| tree | 9fafebf5a42b4aa4736fbc1b4cebdc5d5e87ed24 /src/script.cpp | |
| parent | Merge pull request #2167 from Diapolo/Qt_laa_flag (diff) | |
| parent | Make IsCanonicalScript() check the hash type more thoroughly (diff) | |
| download | discoin-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.cpp | 3 |
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"); |