diff options
-rw-r--r-- | src/script/miniscript.cpp | 6 | ||||
-rw-r--r-- | src/script/miniscript.h | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/script/miniscript.cpp b/src/script/miniscript.cpp index b91152671f..d2de61520b 100644 --- a/src/script/miniscript.cpp +++ b/src/script/miniscript.cpp @@ -281,9 +281,9 @@ size_t ComputeScriptLen(Fragment fragment, Type sub0typ, size_t subsize, uint32_ return 0; } -std::optional<std::vector<std::pair<opcodetype, std::vector<unsigned char>>>> DecomposeScript(const CScript& script) +std::optional<std::vector<Opcode>> DecomposeScript(const CScript& script) { - std::vector<std::pair<opcodetype, std::vector<unsigned char>>> out; + std::vector<Opcode> out; CScript::const_iterator it = script.begin(), itend = script.end(); while (it != itend) { std::vector<unsigned char> push_data; @@ -317,7 +317,7 @@ std::optional<std::vector<std::pair<opcodetype, std::vector<unsigned char>>>> De return out; } -std::optional<int64_t> ParseScriptNumber(const std::pair<opcodetype, std::vector<unsigned char>>& in) { +std::optional<int64_t> ParseScriptNumber(const Opcode& in) { if (in.first == OP_0) { return 0; } diff --git a/src/script/miniscript.h b/src/script/miniscript.h index 2f591cd3e5..e38bb1c37d 100644 --- a/src/script/miniscript.h +++ b/src/script/miniscript.h @@ -180,6 +180,8 @@ inline constexpr Type operator"" _mst(const char* c, size_t l) { return typ; } +using Opcode = std::pair<opcodetype, std::vector<unsigned char>>; + template<typename Key> struct Node; template<typename Key> using NodeRef = std::shared_ptr<const Node<Key>>; @@ -1269,10 +1271,10 @@ inline NodeRef<Key> Parse(Span<const char> in, const Ctx& ctx) * and OP_EQUALVERIFY are decomposed into OP_CHECKSIG, OP_CHECKMULTISIG, OP_EQUAL * respectively, plus OP_VERIFY. */ -std::optional<std::vector<std::pair<opcodetype, std::vector<unsigned char>>>> DecomposeScript(const CScript& script); +std::optional<std::vector<Opcode>> DecomposeScript(const CScript& script); /** Determine whether the passed pair (created by DecomposeScript) is pushing a number. */ -std::optional<int64_t> ParseScriptNumber(const std::pair<opcodetype, std::vector<unsigned char>>& in); +std::optional<int64_t> ParseScriptNumber(const Opcode& in); enum class DecodeContext { /** A single expression of type B, K, or V. Specifically, this can't be an |