Add XOnlyPubKey::CreateTapTweak

This commit is contained in:
Pieter Wuille
2021-05-23 18:32:30 -07:00
parent 2fbfb1becb
commit 5f6cc8daa8
2 changed files with 22 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
#include <uint256.h>
#include <cstring>
#include <optional>
#include <vector>
const unsigned int BIP32_EXTKEY_SIZE = 74;
@@ -251,6 +252,9 @@ public:
* Merkle root, and parity. */
bool CheckTapTweak(const XOnlyPubKey& internal, const uint256& merkle_root, bool parity) const;
/** Construct a Taproot tweaked output point with this point as internal key. */
std::optional<std::pair<XOnlyPubKey, bool>> CreateTapTweak(const uint256* merkle_root) const;
const unsigned char& operator[](int pos) const { return *(m_keydata.begin() + pos); }
const unsigned char* data() const { return m_keydata.begin(); }
static constexpr size_t size() { return decltype(m_keydata)::size(); }