Improve comments in taproot signing logic

This commit is contained in:
Pieter Wuille
2021-06-17 16:54:56 -07:00
parent 4fc15d1566
commit addb9b5a71
4 changed files with 23 additions and 8 deletions

View File

@@ -133,10 +133,15 @@ public:
* optionally tweaked by *merkle_root. Additional nonce entropy can be provided through
* aux.
*
* When merkle_root is not nullptr, this results in a signature with a modified key as
* specified in BIP341:
* - If merkle_root->IsNull(): key + H_TapTweak(pubkey)*G
* - Otherwise: key + H_TapTweak(pubkey || *merkle_root)
* merkle_root is used to optionally perform tweaking of the private key, as specified
* in BIP341:
* - If merkle_root == nullptr: no tweaking is done, sign with key directly (this is
* used for signatures in BIP342 script).
* - If merkle_root->IsNull(): sign with key + H_TapTweak(pubkey) (this is used for
* key path spending when no scripts are present).
* - Otherwise: sign with key + H_TapTweak(pubkey || *merkle_root)
* (this is used for key path spending, with specific
* Merkle root of the script tree).
*/
bool SignSchnorr(const uint256& hash, Span<unsigned char> sig, const uint256* merkle_root = nullptr, const uint256* aux = nullptr) const;