diff options
author | brunoerg <brunoely.gc@gmail.com> | 2023-12-08 06:54:00 -0300 |
---|---|---|
committer | brunoerg <brunoely.gc@gmail.com> | 2023-12-08 06:54:00 -0300 |
commit | e1281f1bbd884f15d40053c9bc24794d0ce9a58a (patch) | |
tree | 6d7b9437cf6fe316138df464b8d8de6c99a58b90 /src/script/descriptor.cpp | |
parent | dce1dfbc47050404bcf3ce2461e8baff0b088ffb (diff) |
wallet: fix key parsing check for miniscript expressions in `ParseScript`
Diffstat (limited to 'src/script/descriptor.cpp')
-rw-r--r-- | src/script/descriptor.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index 7e62d75583..c6bc5f8f1d 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -1777,15 +1777,15 @@ std::unique_ptr<DescriptorImpl> ParseScript(uint32_t& key_exp_index, Span<const const auto script_ctx{ctx == ParseScriptContext::P2WSH ? miniscript::MiniscriptContext::P2WSH : miniscript::MiniscriptContext::TAPSCRIPT}; KeyParser parser(/*out = */&out, /* in = */nullptr, /* ctx = */script_ctx, key_exp_index); auto node = miniscript::FromString(std::string(expr.begin(), expr.end()), parser); + if (parser.m_key_parsing_error != "") { + error = std::move(parser.m_key_parsing_error); + return nullptr; + } if (node) { if (ctx != ParseScriptContext::P2WSH && ctx != ParseScriptContext::P2TR) { error = "Miniscript expressions can only be used in wsh or tr."; return nullptr; } - if (parser.m_key_parsing_error != "") { - error = std::move(parser.m_key_parsing_error); - return nullptr; - } if (!node->IsSane() || node->IsNotSatisfiable()) { // Try to find the first insane sub for better error reporting. auto insane_node = node.get(); |