aboutsummaryrefslogtreecommitdiff
path: root/src/pubkey.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pubkey.cpp')
-rw-r--r--src/pubkey.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pubkey.cpp b/src/pubkey.cpp
index bdab13760..ebd94c482 100644
--- a/src/pubkey.cpp
+++ b/src/pubkey.cpp
@@ -42,6 +42,18 @@ bool CPubKey::IsFullyValid() const {
return true;
}
+bool CPubKey::Compress() {
+ if (!IsValid())
+ return false;
+ CECKey key;
+ if (!key.SetPubKey(begin(), size()))
+ return false;
+ std::vector<unsigned char> pubkey;
+ key.GetPubKey(pubkey, true);
+ Set(pubkey.begin(), pubkey.end());
+ return true;
+}
+
bool CPubKey::Decompress() {
if (!IsValid())
return false;