| 20 | |
| 21 | SimpleSignatureChecker(const uint256& hashIn, bool sighash_byte_in) : hash(hashIn), sighash_byte(sighash_byte_in) {}; |
| 22 | bool CheckECDSASignature(const std::vector<unsigned char>& vchSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion, unsigned int flags) const override |
| 23 | { |
| 24 | std::vector<unsigned char> vchSigCopy(vchSig); |
| 25 | CPubKey pubkey(vchPubKey); |
| 26 | if (!pubkey.IsValid()) |
| 27 | return false; |
| 28 | if (vchSig.empty()) |
| 29 | return false; |
| 30 | // Get rid of sighash byte before verifying hash |
| 31 | // Note: We only accept SIGHASH_ALL! |
| 32 | if (sighash_byte) { |
| 33 | const unsigned char popped_byte = vchSigCopy.back(); |
| 34 | vchSigCopy.pop_back(); |
| 35 | if (popped_byte != SIGHASH_ALL) { |
| 36 | return false; |
| 37 | } |
| 38 | } |
| 39 | return pubkey.Verify(hash, vchSig); |
| 40 | } |
| 41 | }; |
| 42 | |
| 43 | class SimpleSignatureCreator : public BaseSignatureCreator |