mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-02 03:31:35 +02:00
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.
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user