MCPcopy Create free account
hub / github.com/citp/BlockSci / MatchPayToPubkey

Function MatchPayToPubkey

tools/parser/script_output.cpp:37–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35using valtype = ranges::subrange<const unsigned char *>;
36
37static bool MatchPayToPubkey(const CScriptView& script, valtype& pubkey)
38{
39 if (script.size() == CPubKey::PUBLIC_KEY_SIZE + 2 && script[0] == CPubKey::PUBLIC_KEY_SIZE && script.back() == OP_CHECKSIG) {
40 pubkey = valtype(script.begin() + 1, script.begin() + blocksci::CPubKey::PUBLIC_KEY_SIZE + 1);
41 return CPubKey::ValidSize(pubkey | ranges::to_vector);
42 }
43 if (script.size() == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE + 2 && script[0] == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE && script.back() == OP_CHECKSIG) {
44 pubkey = valtype(script.begin() + 1, script.begin() + CPubKey::COMPRESSED_PUBLIC_KEY_SIZE + 1);
45 return CPubKey::ValidSize(pubkey | ranges::to_vector);
46 }
47 return false;
48}
49
50static bool MatchPayToPubkeyHash(const CScriptView& script, valtype& pubkeyhash)
51{

Callers 1

extractScriptDataFunction · 0.85

Calls 3

ValidSizeFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected