Adding a Compress method to the CPubKey class to mirror the Decompress method

This commit is contained in:
Andymeows 2014-08-07 17:48:28 -05:00 committed by Andy Mornes
parent 44228bbc26
commit ec6887b845
2 changed files with 13 additions and 0 deletions

View file

@ -509,6 +509,16 @@ bool CPubKey::IsFullyValid() const {
return true;
}
bool CPubKey::Compress() {
if (!IsValid())
return false;
CECKey key;
if (!key.SetPubKey(*this))
return false;
key.GetPubKey(*this, true);
return true;
}
bool CPubKey::Decompress() {
if (!IsValid())
return false;

View file

@ -163,6 +163,9 @@ public:
// Recover a public key from a compact signature.
bool RecoverCompact(const uint256 &hash, const std::vector<unsigned char>& vchSig);
// Turn this public key into a compressed public key.
bool Compress();
// Turn this public key into an uncompressed public key.
bool Decompress();