Changeset View
Changeset View
Standalone View
Standalone View
src/script/interpreter.cpp
Show First 20 Lines • Show All 935 Lines • ▼ Show 20 Lines | try { | ||||
} | } | ||||
bool fSuccess = false; | bool fSuccess = false; | ||||
if (vchSig.size()) { | if (vchSig.size()) { | ||||
valtype vchHash(32); | valtype vchHash(32); | ||||
CSHA256() | CSHA256() | ||||
.Write(vchMessage.data(), vchMessage.size()) | .Write(vchMessage.data(), vchMessage.size()) | ||||
.Finalize(vchHash.data()); | .Finalize(vchHash.data()); | ||||
uint256 message(vchHash); | fSuccess = checker.VerifySignature( | ||||
CPubKey pubkey(vchPubKey); | vchSig, CPubKey(vchPubKey), uint256(vchHash)); | ||||
fSuccess = pubkey.Verify(message, vchSig); | |||||
} | } | ||||
if (!fSuccess && (flags & SCRIPT_VERIFY_NULLFAIL) && | if (!fSuccess && (flags & SCRIPT_VERIFY_NULLFAIL) && | ||||
vchSig.size()) { | vchSig.size()) { | ||||
return set_error(serror, SCRIPT_ERR_SIG_NULLFAIL); | return set_error(serror, SCRIPT_ERR_SIG_NULLFAIL); | ||||
} | } | ||||
popstack(stack); | popstack(stack); | ||||
▲ Show 20 Lines • Show All 503 Lines • ▼ Show 20 Lines | uint256 SignatureHash(const CScript &scriptCode, const CTransaction &txTo, | ||||
CTransactionSignatureSerializer txTmp(txTo, scriptCode, nIn, sigHashType); | CTransactionSignatureSerializer txTmp(txTo, scriptCode, nIn, sigHashType); | ||||
// Serialize and hash | // Serialize and hash | ||||
CHashWriter ss(SER_GETHASH, 0); | CHashWriter ss(SER_GETHASH, 0); | ||||
ss << txTmp << sigHashType; | ss << txTmp << sigHashType; | ||||
return ss.GetHash(); | return ss.GetHash(); | ||||
} | } | ||||
bool TransactionSignatureChecker::VerifySignature( | bool BaseSignatureChecker::VerifySignature(const std::vector<uint8_t> &vchSig, | ||||
const std::vector<uint8_t> &vchSig, const CPubKey &pubkey, | const CPubKey &pubkey, | ||||
const uint256 &sighash) const { | const uint256 &sighash) const { | ||||
return pubkey.Verify(sighash, vchSig); | return pubkey.Verify(sighash, vchSig); | ||||
} | } | ||||
bool TransactionSignatureChecker::CheckSig( | bool TransactionSignatureChecker::CheckSig( | ||||
const std::vector<uint8_t> &vchSigIn, const std::vector<uint8_t> &vchPubKey, | const std::vector<uint8_t> &vchSigIn, const std::vector<uint8_t> &vchPubKey, | ||||
const CScript &scriptCode, uint32_t flags) const { | const CScript &scriptCode, uint32_t flags) const { | ||||
CPubKey pubkey(vchPubKey); | CPubKey pubkey(vchPubKey); | ||||
if (!pubkey.IsValid()) { | if (!pubkey.IsValid()) { | ||||
▲ Show 20 Lines • Show All 189 Lines • Show Last 20 Lines |