diff options
| author | Pieter Wuille <[email protected]> | 2020-09-11 14:33:45 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2020-10-12 17:17:56 -0700 |
| commit | 8bbed4b7acf4c76eaea8c0e10f3cbf6ba4e53809 (patch) | |
| tree | 32afa457bf2ead02197781c43087b5f83f499d15 /src/pubkey.cpp | |
| parent | Support for Schnorr signatures and integration in SignatureCheckers (BIP 340) (diff) | |
| download | discoin-8bbed4b7acf4c76eaea8c0e10f3cbf6ba4e53809.tar.xz discoin-8bbed4b7acf4c76eaea8c0e10f3cbf6ba4e53809.zip | |
Implement Taproot validation (BIP 341)
This includes key path spending and script path spending, but not the
Tapscript execution implementation (leaf 0xc0 remains unemcumbered in
this commit).
Includes constants for various aspects of the consensus rules suggested
by Jeremy Rubin.
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 69e3d9139..4d734fc89 100644 --- a/src/pubkey.cpp +++ b/src/pubkey.cpp @@ -181,6 +181,13 @@ bool XOnlyPubKey::VerifySchnorr(const uint256& msg, Span<const unsigned char> si return secp256k1_schnorrsig_verify(secp256k1_context_verify, sigbytes.data(), msg.begin(), &pubkey); } +bool XOnlyPubKey::CheckPayToContract(const XOnlyPubKey& base, const uint256& hash, bool parity) const +{ + secp256k1_xonly_pubkey base_point; + if (!secp256k1_xonly_pubkey_parse(secp256k1_context_verify, &base_point, base.data())) return false; + return secp256k1_xonly_pubkey_tweak_add_check(secp256k1_context_verify, m_keydata.begin(), parity, &base_point, hash.begin()); +} + bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig) const { if (!IsValid()) return false; |