diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2023-07-11 11:26:22 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2023-07-20 11:04:52 -0300 |
commit | cc781a21800a6ce13875feefd0cb14ab0a84524c (patch) | |
tree | 7c05a9f6a2598ab30345f30ba28401f7d4f0caac /src/script/descriptor.cpp | |
parent | 286e0c7d5e9538198b28b792c5168b8fafa1534f (diff) |
descriptor: InferScript, do not return top-level only func as sub descriptor
e.g. sh(addr(ADDR)) or sh(raw(HEX)) are invalid descriptors.
Making sh and wsh top level functions to return addr/raw descriptors when
the subscript inference fails.
Diffstat (limited to 'src/script/descriptor.cpp')
-rw-r--r-- | src/script/descriptor.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index dff6429259..c13338c01a 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -1717,6 +1717,10 @@ std::unique_ptr<DescriptorImpl> InferScript(const CScript& script, ParseScriptCo } } + // The following descriptors are all top-level only descriptors. + // So if we are not at the top level, return early. + if (ctx != ParseScriptContext::TOP) return nullptr; + CTxDestination dest; if (ExtractDestination(script, dest)) { if (GetScriptForDestination(dest) == script) { |