diff options
author | Pieter Wuille <pieter@wuille.net> | 2021-06-05 15:29:04 -0700 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2021-06-18 11:23:17 -0700 |
commit | 29e5dd1a5b9a1879e6c3c7e153b2e6f33a79e905 (patch) | |
tree | 8aaa158d145dc0f23b4316f85c9b86ca17eace12 /src/script/interpreter.h | |
parent | 0f47e01d7d491fd240f4b14302bf9edf4f05142c (diff) |
consensus refactor: extract ComputeTapleafHash, ComputeTaprootMerkleRoot
Diffstat (limited to 'src/script/interpreter.h')
-rw-r--r-- | src/script/interpreter.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/script/interpreter.h b/src/script/interpreter.h index ced5c28bc1..034c937b99 100644 --- a/src/script/interpreter.h +++ b/src/script/interpreter.h @@ -317,6 +317,12 @@ public: } }; +/** Compute the BIP341 tapleaf hash from leaf version & script. */ +uint256 ComputeTapleafHash(uint8_t leaf_version, const CScript& script); +/** Compute the BIP341 taproot script tree Merkle root from control block and leaf hash. + * Requires control block to have valid length (33 + k*32, with k in {0,1,..,128}). */ +uint256 ComputeTaprootMerkleRoot(Span<const unsigned char> control, const uint256& tapleaf_hash); + bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, unsigned int flags, const BaseSignatureChecker& checker, SigVersion sigversion, ScriptExecutionData& execdata, ScriptError* error = nullptr); bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, unsigned int flags, const BaseSignatureChecker& checker, SigVersion sigversion, ScriptError* error = nullptr); bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const CScriptWitness* witness, unsigned int flags, const BaseSignatureChecker& checker, ScriptError* serror = nullptr); |