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

Function IsToPubKey

src/compressor.cpp:40–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40static bool IsToPubKey(const CScript& script, CPubKey &pubkey)
41{
42 if (script.size() == 35 && script[0] == 33 && script[34] == OP_CHECKSIG
43 && (script[1] == 0x02 || script[1] == 0x03)) {
44 pubkey.Set(&script[1], &script[34]);
45 return true;
46 }
47 if (script.size() == 67 && script[0] == 65 && script[66] == OP_CHECKSIG
48 && script[1] == 0x04) {
49 pubkey.Set(&script[1], &script[66]);
50 return pubkey.IsFullyValid(); // if not fully valid, a case that would not be compressible
51 }
52 return false;
53}
54
55bool CompressScript(const CScript& script, CompressedScript& out)
56{

Callers 1

CompressScriptFunction · 0.85

Calls 3

IsFullyValidMethod · 0.80
sizeMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected