MCPcopy Create free account
hub / github.com/ElementsProject/elements / SimpleSignatureChecker

Class SimpleSignatureChecker

src/script/generic.hpp:15–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15class SimpleSignatureChecker : public BaseSignatureChecker
16{
17public:
18 uint256 hash;
19 bool sighash_byte;
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
43class SimpleSignatureCreator : public BaseSignatureCreator
44{

Callers 1

GenericVerifyScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected