aboutsummaryrefslogtreecommitdiff
path: root/src/pubkey.cpp
diff options
context:
space:
mode:
authorMax K <[email protected]>2018-01-28 18:44:52 +0100
committerRoss Nicoll <[email protected]>2019-03-25 05:36:12 +0000
commit2a0c66035d0fb53b3d12b299707244a13d19cb37 (patch)
treeb4760c7b98acb27a10c895375e104e1c11d3d92f /src/pubkey.cpp
parentUpdate about menu icon to Dogecoin (diff)
downloaddiscoin-2a0c66035d0fb53b3d12b299707244a13d19cb37.tar.xz
discoin-2a0c66035d0fb53b3d12b299707244a13d19cb37.zip
Re-add paperwallet printer (#1467)
* Add paper wallet generator to QT wallet * Replace print icon with Typeicons equivalent * Re-add printer support to Qt * depends: fix fontconfig with newer glibc See comment for more detail * Set fixed size for paper wallet dialog
Diffstat (limited to 'src/pubkey.cpp')
-rw-r--r--src/pubkey.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pubkey.cpp b/src/pubkey.cpp
index e57fa238c..b0407cbee 100644
--- a/src/pubkey.cpp
+++ b/src/pubkey.cpp
@@ -211,6 +211,19 @@ bool CPubKey::IsFullyValid() const {
return secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size());
}
+bool CPubKey::Compress() {
+ if (!IsValid())
+ return false;
+ secp256k1_pubkey pubkey;
+ if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size()))
+ return false;
+ unsigned char pub[33];
+ size_t publen = 33;
+ secp256k1_ec_pubkey_serialize(secp256k1_context_verify, pub, &publen, &pubkey, SECP256K1_EC_COMPRESSED);
+ Set(pub, pub + publen);
+ return true;
+}
+
bool CPubKey::Decompress() {
if (!IsValid())
return false;