diff options
author | Antoine Poinsot <darosior@protonmail.com> | 2023-02-14 10:31:32 +0100 |
---|---|---|
committer | Antoine Poinsot <darosior@protonmail.com> | 2023-10-08 02:43:19 +0200 |
commit | fcb6f13f442d6a3f27689a87e3ed2bb9b431a332 (patch) | |
tree | 643b4e10ed9108d579fcae63cde68b851d9cb8b2 /src/pubkey.cpp | |
parent | ce8845f5dda403461178c08e7363978fda423999 (diff) | |
download | bitcoin-fcb6f13f442d6a3f27689a87e3ed2bb9b431a332.tar.xz |
pubkey: introduce a GetEvenCorrespondingCPubKey helper
We'll need to get a compressed key out of an x-only one in other places.
Avoid duplicating the code.
Diffstat (limited to 'src/pubkey.cpp')
-rw-r--r-- | src/pubkey.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pubkey.cpp b/src/pubkey.cpp index 05808e4c22..11e1b4abb5 100644 --- a/src/pubkey.cpp +++ b/src/pubkey.cpp @@ -204,6 +204,13 @@ std::vector<CKeyID> XOnlyPubKey::GetKeyIDs() const return out; } +CPubKey XOnlyPubKey::GetEvenCorrespondingCPubKey() const +{ + unsigned char full_key[CPubKey::COMPRESSED_SIZE] = {0x02}; + std::copy(begin(), end(), full_key + 1); + return CPubKey{full_key}; +} + bool XOnlyPubKey::IsFullyValid() const { secp256k1_xonly_pubkey pubkey; |