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

Method IsToPubKey

src/compressor.cpp:33–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33bool CScriptCompressor::IsToPubKey(CPubKey &pubkey) const
34{
35 if (script.size() == 35 && script[0] == 33 && script[34] == OP_CHECKSIG
36 && (script[1] == 0x02 || script[1] == 0x03)) {
37 pubkey.Set(&script[1], &script[34]);
38 return true;
39 }
40 if (script.size() == 67 && script[0] == 65 && script[66] == OP_CHECKSIG
41 && script[1] == 0x04) {
42 pubkey.Set(&script[1], &script[66]);
43 return pubkey.IsFullyValid(); // if not fully valid, a case that would not be compressible
44 }
45 return false;
46}
47
48bool CScriptCompressor::Compress(std::vector<unsigned char> &out) const
49{

Callers

nothing calls this directly

Calls 3

IsFullyValidMethod · 0.80
sizeMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected