| 2987 | |
| 2988 | template <class T> |
| 2989 | bool GenericTransactionSignatureChecker<T>::CheckECDSASignature(const std::vector<unsigned char>& vchSigIn, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion, unsigned int flags) const |
| 2990 | { |
| 2991 | CPubKey pubkey(vchPubKey); |
| 2992 | if (!pubkey.IsValid()) |
| 2993 | return false; |
| 2994 | |
| 2995 | // Hash type is one byte tacked on to the end of the signature |
| 2996 | std::vector<unsigned char> vchSig(vchSigIn); |
| 2997 | if (vchSig.empty()) |
| 2998 | return false; |
| 2999 | int nHashType = vchSig.back(); |
| 3000 | vchSig.pop_back(); |
| 3001 | |
| 3002 | // Witness sighashes need the amount. |
| 3003 | if (sigversion == SigVersion::WITNESS_V0 && amount.IsNull()) return HandleMissingData(m_mdb); |
| 3004 | |
| 3005 | uint256 sighash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, sigversion, flags, this->txdata, &m_sighash_cache); |
| 3006 | |
| 3007 | if (!VerifyECDSASignature(vchSig, pubkey, sighash)) |
| 3008 | return false; |
| 3009 | |
| 3010 | return true; |
| 3011 | } |
| 3012 | |
| 3013 | template <class T> |
| 3014 | bool GenericTransactionSignatureChecker<T>::CheckSchnorrSignature(Span<const unsigned char> sig, Span<const unsigned char> pubkey_in, SigVersion sigversion, ScriptExecutionData& execdata, ScriptError* serror) const |
no test coverage detected