mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-10 19:43:13 +02:00
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.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user