From 2a0c66035d0fb53b3d12b299707244a13d19cb37 Mon Sep 17 00:00:00 2001 From: Max K Date: Sun, 28 Jan 2018 18:44:52 +0100 Subject: 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 --- src/pubkey.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/pubkey.cpp') 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; -- cgit v1.2.3