| 269 | } |
| 270 | |
| 271 | bool static IsDefinedHashtypeSignature(const valtype &vchSig, unsigned int flags) { |
| 272 | if (vchSig.size() == 0) { |
| 273 | return false; |
| 274 | } |
| 275 | unsigned char nHashType = vchSig[vchSig.size() - 1] & (~(SIGHASH_ANYONECANPAY)); |
| 276 | |
| 277 | // ELEMENTS: Only allow SIGHASH_RANGEPROOF if the flag is set (after dynafed activation). |
| 278 | if ((flags & SCRIPT_SIGHASH_RANGEPROOF) == SCRIPT_SIGHASH_RANGEPROOF) { |
| 279 | nHashType = nHashType & (~(SIGHASH_RANGEPROOF)); |
| 280 | } |
| 281 | |
| 282 | if (nHashType < SIGHASH_ALL || nHashType > SIGHASH_SINGLE) |
| 283 | return false; |
| 284 | |
| 285 | return true; |
| 286 | } |
| 287 | |
| 288 | bool CheckSignatureEncoding(const std::vector<unsigned char> &vchSig, unsigned int flags, ScriptError* serror) { |
| 289 | // Empty signature. Not strictly DER encoded, but allowed to provide a |
no test coverage detected