MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / IsToPubKey

Function IsToPubKey

src/compressor.cpp:41–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

CompressScriptFunction · 0.85

Calls 3

IsFullyValidMethod · 0.80
sizeMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected