Do not use CScript for tapleaf scripts until the tapleaf version is known

Prevents use of CScript methods until the tapleaf is known to be a tapscript.
This commit is contained in:
Russell O'Connor
2022-08-19 10:40:28 -04:00
parent 60a00889b0
commit 8e3fc99427
8 changed files with 29 additions and 29 deletions

View File

@@ -1643,7 +1643,7 @@ std::unique_ptr<DescriptorImpl> InferScript(const CScript& script, ParseScriptCo
for (const auto& [depth, script, leaf_ver] : *tree) {
std::unique_ptr<DescriptorImpl> subdesc;
if (leaf_ver == TAPROOT_LEAF_TAPSCRIPT) {
subdesc = InferScript(script, ParseScriptContext::P2TR, provider);
subdesc = InferScript(CScript(script.begin(), script.end()), ParseScriptContext::P2TR, provider);
}
if (!subdesc) {
ok = false;