Coverage Report

Created: 2025-06-10 13:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/bitcoin/src/script/miniscript.h
Line
Count
Source
1
// Copyright (c) 2019-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_SCRIPT_MINISCRIPT_H
6
#define BITCOIN_SCRIPT_MINISCRIPT_H
7
8
#include <algorithm>
9
#include <compare>
10
#include <cstdint>
11
#include <cstdlib>
12
#include <iterator>
13
#include <memory>
14
#include <optional>
15
#include <set>
16
#include <stdexcept>
17
#include <tuple>
18
#include <utility>
19
#include <vector>
20
21
#include <consensus/consensus.h>
22
#include <policy/policy.h>
23
#include <script/interpreter.h>
24
#include <script/parsing.h>
25
#include <script/script.h>
26
#include <serialize.h>
27
#include <span.h>
28
#include <util/check.h>
29
#include <util/strencodings.h>
30
#include <util/string.h>
31
#include <util/vector.h>
32
33
namespace miniscript {
34
35
/** This type encapsulates the miniscript type system properties.
36
 *
37
 * Every miniscript expression is one of 4 basic types, and additionally has
38
 * a number of boolean type properties.
39
 *
40
 * The basic types are:
41
 * - "B" Base:
42
 *   - Takes its inputs from the top of the stack.
43
 *   - When satisfied, pushes a nonzero value of up to 4 bytes onto the stack.
44
 *   - When dissatisfied, pushes a 0 onto the stack.
45
 *   - This is used for most expressions, and required for the top level one.
46
 *   - For example: older(n) = <n> OP_CHECKSEQUENCEVERIFY.
47
 * - "V" Verify:
48
 *   - Takes its inputs from the top of the stack.
49
 *   - When satisfied, pushes nothing.
50
 *   - Cannot be dissatisfied.
51
 *   - This can be obtained by adding an OP_VERIFY to a B, modifying the last opcode
52
 *     of a B to its -VERIFY version (only for OP_CHECKSIG, OP_CHECKSIGVERIFY,
53
 *     OP_NUMEQUAL and OP_EQUAL), or by combining a V fragment under some conditions.
54
 *   - For example vc:pk_k(key) = <key> OP_CHECKSIGVERIFY
55
 * - "K" Key:
56
 *   - Takes its inputs from the top of the stack.
57
 *   - Becomes a B when followed by OP_CHECKSIG.
58
 *   - Always pushes a public key onto the stack, for which a signature is to be
59
 *     provided to satisfy the expression.
60
 *   - For example pk_h(key) = OP_DUP OP_HASH160 <Hash160(key)> OP_EQUALVERIFY
61
 * - "W" Wrapped:
62
 *   - Takes its input from one below the top of the stack.
63
 *   - When satisfied, pushes a nonzero value (like B) on top of the stack, or one below.
64
 *   - When dissatisfied, pushes 0 op top of the stack or one below.
65
 *   - Is always "OP_SWAP [B]" or "OP_TOALTSTACK [B] OP_FROMALTSTACK".
66
 *   - For example sc:pk_k(key) = OP_SWAP <key> OP_CHECKSIG
67
 *
68
 * There are type properties that help reasoning about correctness:
69
 * - "z" Zero-arg:
70
 *   - Is known to always consume exactly 0 stack elements.
71
 *   - For example after(n) = <n> OP_CHECKLOCKTIMEVERIFY
72
 * - "o" One-arg:
73
 *   - Is known to always consume exactly 1 stack element.
74
 *   - Conflicts with property 'z'
75
 *   - For example sha256(hash) = OP_SIZE 32 OP_EQUALVERIFY OP_SHA256 <hash> OP_EQUAL
76
 * - "n" Nonzero:
77
 *   - For every way this expression can be satisfied, a satisfaction exists that never needs
78
 *     a zero top stack element.
79
 *   - Conflicts with property 'z' and with type 'W'.
80
 * - "d" Dissatisfiable:
81
 *   - There is an easy way to construct a dissatisfaction for this expression.
82
 *   - Conflicts with type 'V'.
83
 * - "u" Unit:
84
 *   - In case of satisfaction, an exact 1 is put on the stack (rather than just nonzero).
85
 *   - Conflicts with type 'V'.
86
 *
87
 * Additional type properties help reasoning about nonmalleability:
88
 * - "e" Expression:
89
 *   - This implies property 'd', but the dissatisfaction is nonmalleable.
90
 *   - This generally requires 'e' for all subexpressions which are invoked for that
91
 *     dissatisfaction, and property 'f' for the unexecuted subexpressions in that case.
92
 *   - Conflicts with type 'V'.
93
 * - "f" Forced:
94
 *   - Dissatisfactions (if any) for this expression always involve at least one signature.
95
 *   - Is always true for type 'V'.
96
 * - "s" Safe:
97
 *   - Satisfactions for this expression always involve at least one signature.
98
 * - "m" Nonmalleable:
99
 *   - For every way this expression can be satisfied (which may be none),
100
 *     a nonmalleable satisfaction exists.
101
 *   - This generally requires 'm' for all subexpressions, and 'e' for all subexpressions
102
 *     which are dissatisfied when satisfying the parent.
103
 *
104
 * One type property is an implementation detail:
105
 * - "x" Expensive verify:
106
 *   - Expressions with this property have a script whose last opcode is not EQUAL, CHECKSIG, or CHECKMULTISIG.
107
 *   - Not having this property means that it can be converted to a V at no cost (by switching to the
108
 *     -VERIFY version of the last opcode).
109
 *
110
 * Five more type properties for representing timelock information. Spend paths
111
 * in miniscripts containing conflicting timelocks and heightlocks cannot be spent together.
112
 * This helps users detect if miniscript does not match the semantic behaviour the
113
 * user expects.
114
 * - "g" Whether the branch contains a relative time timelock
115
 * - "h" Whether the branch contains a relative height timelock
116
 * - "i" Whether the branch contains an absolute time timelock
117
 * - "j" Whether the branch contains an absolute height timelock
118
 * - "k"
119
 *   - Whether all satisfactions of this expression don't contain a mix of heightlock and timelock
120
 *     of the same type.
121
 *   - If the miniscript does not have the "k" property, the miniscript template will not match
122
 *     the user expectation of the corresponding spending policy.
123
 * For each of these properties the subset rule holds: an expression with properties X, Y, and Z, is also
124
 * valid in places where an X, a Y, a Z, an XY, ... is expected.
125
*/
126
class Type {
127
    //! Internal bitmap of properties (see ""_mst operator for details).
128
    uint32_t m_flags;
129
130
    //! Internal constructor.
131
0
    explicit constexpr Type(uint32_t flags) noexcept : m_flags(flags) {}
132
133
public:
134
    //! Construction function used by the ""_mst operator.
135
0
    static consteval Type Make(uint32_t flags) noexcept { return Type(flags); }
136
137
    //! Compute the type with the union of properties.
138
0
    constexpr Type operator|(Type x) const { return Type(m_flags | x.m_flags); }
139
140
    //! Compute the type with the intersection of properties.
141
0
    constexpr Type operator&(Type x) const { return Type(m_flags & x.m_flags); }
142
143
    //! Check whether the left hand's properties are superset of the right's (= left is a subtype of right).
144
0
    constexpr bool operator<<(Type x) const { return (x.m_flags & ~m_flags) == 0; }
145
146
    //! Comparison operator to enable use in sets/maps (total ordering incompatible with <<).
147
0
    constexpr bool operator<(Type x) const { return m_flags < x.m_flags; }
148
149
    //! Equality operator.
150
0
    constexpr bool operator==(Type x) const { return m_flags == x.m_flags; }
151
152
    //! The empty type if x is false, itself otherwise.
153
0
    constexpr Type If(bool x) const { return Type(x ? m_flags : 0); }
  Branch (153:51): [True: 0, False: 0]
154
};
155
156
//! Literal operator to construct Type objects.
157
inline consteval Type operator""_mst(const char* c, size_t l)
158
{
159
    Type typ{Type::Make(0)};
160
161
    for (const char *p = c; p < c + l; p++) {
162
        typ = typ | Type::Make(
163
            *p == 'B' ? 1 << 0 : // Base type
164
            *p == 'V' ? 1 << 1 : // Verify type
165
            *p == 'K' ? 1 << 2 : // Key type
166
            *p == 'W' ? 1 << 3 : // Wrapped type
167
            *p == 'z' ? 1 << 4 : // Zero-arg property
168
            *p == 'o' ? 1 << 5 : // One-arg property
169
            *p == 'n' ? 1 << 6 : // Nonzero arg property
170
            *p == 'd' ? 1 << 7 : // Dissatisfiable property
171
            *p == 'u' ? 1 << 8 : // Unit property
172
            *p == 'e' ? 1 << 9 : // Expression property
173
            *p == 'f' ? 1 << 10 : // Forced property
174
            *p == 's' ? 1 << 11 : // Safe property
175
            *p == 'm' ? 1 << 12 : // Nonmalleable property
176
            *p == 'x' ? 1 << 13 : // Expensive verify
177
            *p == 'g' ? 1 << 14 : // older: contains relative time timelock   (csv_time)
178
            *p == 'h' ? 1 << 15 : // older: contains relative height timelock (csv_height)
179
            *p == 'i' ? 1 << 16 : // after: contains time timelock   (cltv_time)
180
            *p == 'j' ? 1 << 17 : // after: contains height timelock   (cltv_height)
181
            *p == 'k' ? 1 << 18 : // does not contain a combination of height and time locks
182
            (throw std::logic_error("Unknown character in _mst literal"), 0)
183
        );
184
    }
185
186
    return typ;
187
}
188
189
using Opcode = std::pair<opcodetype, std::vector<unsigned char>>;
190
191
template<typename Key> struct Node;
192
template<typename Key> using NodeRef = std::unique_ptr<const Node<Key>>;
193
194
//! Construct a miniscript node as a unique_ptr.
195
template<typename Key, typename... Args>
196
0
NodeRef<Key> MakeNodeRef(Args&&... args) { return std::make_unique<const Node<Key>>(std::forward<Args>(args)...); }
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::MakeNodeRef<unsigned int, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::MakeNodeRef<unsigned int, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, std::allocator<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > > > >(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, std::allocator<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > > >&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::MakeNodeRef<unsigned int, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<unsigned int, std::allocator<unsigned int> > >(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<unsigned int, std::allocator<unsigned int> >&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::MakeNodeRef<unsigned int, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<unsigned char, std::allocator<unsigned char> > >(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<unsigned char, std::allocator<unsigned char> >&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::MakeNodeRef<unsigned int, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, long const&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, long const&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::MakeNodeRef<unsigned int, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<unsigned int, std::allocator<unsigned int> >, long const&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<unsigned int, std::allocator<unsigned int> >&&, long const&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::MakeNodeRef<unsigned int, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext const&, miniscript::Fragment&, std::vector<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, std::allocator<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > > > >(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext const&, miniscript::Fragment&, std::vector<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, std::allocator<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > > >&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::MakeNodeRef<unsigned int, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, std::allocator<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > > >, long&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, std::allocator<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > > >&&, long&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::MakeNodeRef<unsigned int, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, long&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, long&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::MakeNodeRef<unsigned int, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<unsigned char, std::allocator<unsigned char> >&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<unsigned char, std::allocator<unsigned char> >&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > miniscript::MakeNodeRef<XOnlyPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > miniscript::MakeNodeRef<XOnlyPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<XOnlyPubKey, std::allocator<XOnlyPubKey> > >(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<XOnlyPubKey, std::allocator<XOnlyPubKey> >&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > miniscript::MakeNodeRef<XOnlyPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, long&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, long&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > miniscript::MakeNodeRef<XOnlyPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<unsigned char, std::allocator<unsigned char> >&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<unsigned char, std::allocator<unsigned char> >&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > miniscript::MakeNodeRef<XOnlyPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<XOnlyPubKey, std::allocator<XOnlyPubKey> >, long const&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<XOnlyPubKey, std::allocator<XOnlyPubKey> >&&, long const&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > miniscript::MakeNodeRef<XOnlyPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > > > >(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > > >&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > miniscript::MakeNodeRef<XOnlyPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext const&, miniscript::Fragment&, std::vector<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > > > >(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext const&, miniscript::Fragment&, std::vector<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > > >&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > miniscript::MakeNodeRef<XOnlyPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > > >, long&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > > >&&, long&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > miniscript::MakeNodeRef<CPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > miniscript::MakeNodeRef<CPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<CPubKey, std::allocator<CPubKey> > >(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<CPubKey, std::allocator<CPubKey> >&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > miniscript::MakeNodeRef<CPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, long&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, long&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > miniscript::MakeNodeRef<CPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<unsigned char, std::allocator<unsigned char> >&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<unsigned char, std::allocator<unsigned char> >&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > miniscript::MakeNodeRef<CPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<CPubKey, std::allocator<CPubKey> >, long const&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<CPubKey, std::allocator<CPubKey> >&&, long const&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > miniscript::MakeNodeRef<CPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > > > >(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > > >&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > miniscript::MakeNodeRef<CPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext const&, miniscript::Fragment&, std::vector<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > > > >(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext const&, miniscript::Fragment&, std::vector<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > > >&&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > miniscript::MakeNodeRef<CPubKey, miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > > >, long&>(miniscript::internal::NoDupCheck&&, miniscript::MiniscriptContext&&, miniscript::Fragment&&, std::vector<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > > >&&, long&)
197
198
//! The different node types in miniscript.
199
enum class Fragment {
200
    JUST_0,    //!< OP_0
201
    JUST_1,    //!< OP_1
202
    PK_K,      //!< [key]
203
    PK_H,      //!< OP_DUP OP_HASH160 [keyhash] OP_EQUALVERIFY
204
    OLDER,     //!< [n] OP_CHECKSEQUENCEVERIFY
205
    AFTER,     //!< [n] OP_CHECKLOCKTIMEVERIFY
206
    SHA256,    //!< OP_SIZE 32 OP_EQUALVERIFY OP_SHA256 [hash] OP_EQUAL
207
    HASH256,   //!< OP_SIZE 32 OP_EQUALVERIFY OP_HASH256 [hash] OP_EQUAL
208
    RIPEMD160, //!< OP_SIZE 32 OP_EQUALVERIFY OP_RIPEMD160 [hash] OP_EQUAL
209
    HASH160,   //!< OP_SIZE 32 OP_EQUALVERIFY OP_HASH160 [hash] OP_EQUAL
210
    WRAP_A,    //!< OP_TOALTSTACK [X] OP_FROMALTSTACK
211
    WRAP_S,    //!< OP_SWAP [X]
212
    WRAP_C,    //!< [X] OP_CHECKSIG
213
    WRAP_D,    //!< OP_DUP OP_IF [X] OP_ENDIF
214
    WRAP_V,    //!< [X] OP_VERIFY (or -VERIFY version of last opcode in X)
215
    WRAP_J,    //!< OP_SIZE OP_0NOTEQUAL OP_IF [X] OP_ENDIF
216
    WRAP_N,    //!< [X] OP_0NOTEQUAL
217
    AND_V,     //!< [X] [Y]
218
    AND_B,     //!< [X] [Y] OP_BOOLAND
219
    OR_B,      //!< [X] [Y] OP_BOOLOR
220
    OR_C,      //!< [X] OP_NOTIF [Y] OP_ENDIF
221
    OR_D,      //!< [X] OP_IFDUP OP_NOTIF [Y] OP_ENDIF
222
    OR_I,      //!< OP_IF [X] OP_ELSE [Y] OP_ENDIF
223
    ANDOR,     //!< [X] OP_NOTIF [Z] OP_ELSE [Y] OP_ENDIF
224
    THRESH,    //!< [X1] ([Xn] OP_ADD)* [k] OP_EQUAL
225
    MULTI,     //!< [k] [key_n]* [n] OP_CHECKMULTISIG (only available within P2WSH context)
226
    MULTI_A,   //!< [key_0] OP_CHECKSIG ([key_n] OP_CHECKSIGADD)* [k] OP_NUMEQUAL (only within Tapscript ctx)
227
    // AND_N(X,Y) is represented as ANDOR(X,Y,0)
228
    // WRAP_T(X) is represented as AND_V(X,1)
229
    // WRAP_L(X) is represented as OR_I(0,X)
230
    // WRAP_U(X) is represented as OR_I(X,0)
231
};
232
233
enum class Availability {
234
    NO,
235
    YES,
236
    MAYBE,
237
};
238
239
enum class MiniscriptContext {
240
    P2WSH,
241
    TAPSCRIPT,
242
};
243
244
/** Whether the context Tapscript, ensuring the only other possibility is P2WSH. */
245
constexpr bool IsTapscript(MiniscriptContext ms_ctx)
246
0
{
247
0
    switch (ms_ctx) {
  Branch (247:13): [True: 0, False: 0]
248
0
        case MiniscriptContext::P2WSH: return false;
  Branch (248:9): [True: 0, False: 0]
249
0
        case MiniscriptContext::TAPSCRIPT: return true;
  Branch (249:9): [True: 0, False: 0]
250
0
    }
251
0
    assert(false);
  Branch (251:5): [Folded - Ignored]
252
0
}
253
254
namespace internal {
255
256
//! The maximum size of a witness item for a Miniscript under Tapscript context. (A BIP340 signature with a sighash type byte.)
257
static constexpr uint32_t MAX_TAPMINISCRIPT_STACK_ELEM_SIZE{65};
258
259
//! version + nLockTime
260
constexpr uint32_t TX_OVERHEAD{4 + 4};
261
//! prevout + nSequence + scriptSig
262
constexpr uint32_t TXIN_BYTES_NO_WITNESS{36 + 4 + 1};
263
//! nValue + script len + OP_0 + pushdata 32.
264
constexpr uint32_t P2WSH_TXOUT_BYTES{8 + 1 + 1 + 33};
265
//! Data other than the witness in a transaction. Overhead + vin count + one vin + vout count + one vout + segwit marker
266
constexpr uint32_t TX_BODY_LEEWAY_WEIGHT{(TX_OVERHEAD + GetSizeOfCompactSize(1) + TXIN_BYTES_NO_WITNESS + GetSizeOfCompactSize(1) + P2WSH_TXOUT_BYTES) * WITNESS_SCALE_FACTOR + 2};
267
//! Maximum possible stack size to spend a Taproot output (excluding the script itself).
268
constexpr uint32_t MAX_TAPSCRIPT_SAT_SIZE{GetSizeOfCompactSize(MAX_STACK_SIZE) + (GetSizeOfCompactSize(MAX_TAPMINISCRIPT_STACK_ELEM_SIZE) + MAX_TAPMINISCRIPT_STACK_ELEM_SIZE) * MAX_STACK_SIZE + GetSizeOfCompactSize(TAPROOT_CONTROL_MAX_SIZE) + TAPROOT_CONTROL_MAX_SIZE};
269
/** The maximum size of a script depending on the context. */
270
constexpr uint32_t MaxScriptSize(MiniscriptContext ms_ctx)
271
0
{
272
0
    if (IsTapscript(ms_ctx)) {
  Branch (272:9): [True: 0, False: 0]
273
        // Leaf scripts under Tapscript are not explicitly limited in size. They are only implicitly
274
        // bounded by the maximum standard size of a spending transaction. Let the maximum script
275
        // size conservatively be small enough such that even a maximum sized witness and a reasonably
276
        // sized spending transaction can spend an output paying to this script without running into
277
        // the maximum standard tx size limit.
278
0
        constexpr auto max_size{MAX_STANDARD_TX_WEIGHT - TX_BODY_LEEWAY_WEIGHT - MAX_TAPSCRIPT_SAT_SIZE};
279
0
        return max_size - GetSizeOfCompactSize(max_size);
280
0
    }
281
0
    return MAX_STANDARD_P2WSH_SCRIPT_SIZE;
282
0
}
283
284
//! Helper function for Node::CalcType.
285
Type ComputeType(Fragment fragment, Type x, Type y, Type z, const std::vector<Type>& sub_types, uint32_t k, size_t data_size, size_t n_subs, size_t n_keys, MiniscriptContext ms_ctx);
286
287
//! Helper function for Node::CalcScriptLen.
288
size_t ComputeScriptLen(Fragment fragment, Type sub0typ, size_t subsize, uint32_t k, size_t n_subs, size_t n_keys, MiniscriptContext ms_ctx);
289
290
//! A helper sanitizer/checker for the output of CalcType.
291
Type SanitizeType(Type x);
292
293
//! An object representing a sequence of witness stack elements.
294
struct InputStack {
295
    /** Whether this stack is valid for its intended purpose (satisfaction or dissatisfaction of a Node).
296
     *  The MAYBE value is used for size estimation, when keys/preimages may actually be unavailable,
297
     *  but may be available at signing time. This makes the InputStack structure and signing logic,
298
     *  filled with dummy signatures/preimages usable for witness size estimation.
299
     */
300
    Availability available = Availability::YES;
301
    //! Whether this stack contains a digital signature.
302
    bool has_sig = false;
303
    //! Whether this stack is malleable (can be turned into an equally valid other stack by a third party).
304
    bool malleable = false;
305
    //! Whether this stack is non-canonical (using a construction known to be unnecessary for satisfaction).
306
    //! Note that this flag does not affect the satisfaction algorithm; it is only used for sanity checking.
307
    bool non_canon = false;
308
    //! Serialized witness size.
309
    size_t size = 0;
310
    //! Data elements.
311
    std::vector<std::vector<unsigned char>> stack;
312
    //! Construct an empty stack (valid).
313
33.2k
    InputStack() = default;
314
    //! Construct a valid single-element stack (with an element up to 75 bytes).
315
99.8k
    InputStack(std::vector<unsigned char> in) : size(in.size() + 1), stack(Vector(std::move(in))) {}
316
    //! Change availability
317
    InputStack& SetAvailable(Availability avail);
318
    //! Mark this input stack as having a signature.
319
    InputStack& SetWithSig();
320
    //! Mark this input stack as non-canonical (known to not be necessary in non-malleable satisfactions).
321
    InputStack& SetNonCanon();
322
    //! Mark this input stack as malleable.
323
    InputStack& SetMalleable(bool x = true);
324
    //! Concatenate two input stacks.
325
    friend InputStack operator+(InputStack a, InputStack b);
326
    //! Choose between two potential input stacks.
327
    friend InputStack operator|(InputStack a, InputStack b);
328
};
329
330
/** A stack consisting of a single zero-length element (interpreted as 0 by the script interpreter in numeric context). */
331
static const auto ZERO = InputStack(std::vector<unsigned char>());
332
/** A stack consisting of a single malleable 32-byte 0x0000...0000 element (for dissatisfying hash challenges). */
333
static const auto ZERO32 = InputStack(std::vector<unsigned char>(32, 0)).SetMalleable();
334
/** A stack consisting of a single 0x01 element (interpreted as 1 by the script interpreted in numeric context). */
335
static const auto ONE = InputStack(Vector((unsigned char)1));
336
/** The empty stack. */
337
static const auto EMPTY = InputStack();
338
/** A stack representing the lack of any (dis)satisfactions. */
339
static const auto INVALID = InputStack().SetAvailable(Availability::NO);
340
341
//! A pair of a satisfaction and a dissatisfaction InputStack.
342
struct InputResult {
343
    InputStack nsat, sat;
344
345
    template<typename A, typename B>
346
0
    InputResult(A&& in_nsat, B&& in_sat) : nsat(std::forward<A>(in_nsat)), sat(std::forward<B>(in_sat)) {}
Unexecuted instantiation: miniscript::internal::InputResult::InputResult<miniscript::internal::InputStack const&, miniscript::internal::InputStack&>(miniscript::internal::InputStack const&, miniscript::internal::InputStack&)
Unexecuted instantiation: miniscript::internal::InputResult::InputResult<miniscript::internal::InputStack, miniscript::internal::InputStack&>(miniscript::internal::InputStack&&, miniscript::internal::InputStack&)
Unexecuted instantiation: miniscript::internal::InputResult::InputResult<miniscript::internal::InputStack, miniscript::internal::InputStack>(miniscript::internal::InputStack&&, miniscript::internal::InputStack&&)
Unexecuted instantiation: miniscript::internal::InputResult::InputResult<miniscript::internal::InputStack const&, miniscript::internal::InputStack const&>(miniscript::internal::InputStack const&, miniscript::internal::InputStack const&)
Unexecuted instantiation: miniscript::internal::InputResult::InputResult<miniscript::internal::InputStack&, miniscript::internal::InputStack>(miniscript::internal::InputStack&, miniscript::internal::InputStack&&)
Unexecuted instantiation: miniscript::internal::InputResult::InputResult<miniscript::internal::InputStack const&, miniscript::internal::InputStack>(miniscript::internal::InputStack const&, miniscript::internal::InputStack&&)
347
};
348
349
//! Class whose objects represent the maximum of a list of integers.
350
template<typename I>
351
struct MaxInt {
352
    const bool valid;
353
    const I value;
354
355
0
    MaxInt() : valid(false), value(0) {}
356
0
    MaxInt(I val) : valid(true), value(val) {}
357
358
0
    friend MaxInt<I> operator+(const MaxInt<I>& a, const MaxInt<I>& b) {
359
0
        if (!a.valid || !b.valid) return {};
  Branch (359:13): [True: 0, False: 0]
  Branch (359:25): [True: 0, False: 0]
360
0
        return a.value + b.value;
361
0
    }
362
363
0
    friend MaxInt<I> operator|(const MaxInt<I>& a, const MaxInt<I>& b) {
364
0
        if (!a.valid) return b;
  Branch (364:13): [True: 0, False: 0]
365
0
        if (!b.valid) return a;
  Branch (365:13): [True: 0, False: 0]
366
0
        return std::max(a.value, b.value);
367
0
    }
368
};
369
370
struct Ops {
371
    //! Non-push opcodes.
372
    uint32_t count;
373
    //! Number of keys in possibly executed OP_CHECKMULTISIG(VERIFY)s to satisfy.
374
    MaxInt<uint32_t> sat;
375
    //! Number of keys in possibly executed OP_CHECKMULTISIG(VERIFY)s to dissatisfy.
376
    MaxInt<uint32_t> dsat;
377
378
0
    Ops(uint32_t in_count, MaxInt<uint32_t> in_sat, MaxInt<uint32_t> in_dsat) : count(in_count), sat(in_sat), dsat(in_dsat) {};
379
};
380
381
/** A data structure to help the calculation of stack size limits.
382
 *
383
 * Conceptually, every SatInfo object corresponds to a (possibly empty) set of script execution
384
 * traces (sequences of opcodes).
385
 * - SatInfo{} corresponds to the empty set.
386
 * - SatInfo{n, e} corresponds to a single trace whose net effect is removing n elements from the
387
 *   stack (may be negative for a net increase), and reaches a maximum of e stack elements more
388
 *   than it ends with.
389
 * - operator| is the union operation: (a | b) corresponds to the union of the traces in a and the
390
 *   traces in b.
391
 * - operator+ is the concatenation operator: (a + b) corresponds to the set of traces formed by
392
 *   concatenating any trace in a with any trace in b.
393
 *
394
 * Its fields are:
395
 * - valid is true if the set is non-empty.
396
 * - netdiff (if valid) is the largest difference between stack size at the beginning and at the
397
 *   end of the script across all traces in the set.
398
 * - exec (if valid) is the largest difference between stack size anywhere during execution and at
399
 *   the end of the script, across all traces in the set (note that this is not necessarily due
400
 *   to the same trace as the one that resulted in the value for netdiff).
401
 *
402
 * This allows us to build up stack size limits for any script efficiently, by starting from the
403
 * individual opcodes miniscripts correspond to, using concatenation to construct scripts, and
404
 * using the union operation to choose between execution branches. Since any top-level script
405
 * satisfaction ends with a single stack element, we know that for a full script:
406
 * - netdiff+1 is the maximal initial stack size (relevant for P2WSH stack limits).
407
 * - exec+1 is the maximal stack size reached during execution (relevant for P2TR stack limits).
408
 *
409
 * Mathematically, SatInfo forms a semiring:
410
 * - operator| is the semiring addition operator, with identity SatInfo{}, and which is commutative
411
 *   and associative.
412
 * - operator+ is the semiring multiplication operator, with identity SatInfo{0}, and which is
413
 *   associative.
414
 * - operator+ is distributive over operator|, so (a + (b | c)) = (a+b | a+c). This means we do not
415
 *   need to actually materialize all possible full execution traces over the whole script (which
416
 *   may be exponential in the length of the script); instead we can use the union operation at the
417
 *   individual subexpression level, and concatenate the result with subexpressions before and
418
 *   after it.
419
 * - It is not a commutative semiring, because a+b can differ from b+a. For example, "OP_1 OP_DROP"
420
 *   has exec=1, while "OP_DROP OP_1" has exec=0.
421
 */
422
struct SatInfo {
423
    //! Whether a canonical satisfaction/dissatisfaction is possible at all.
424
    const bool valid;
425
    //! How much higher the stack size at start of execution can be compared to at the end.
426
    const int32_t netdiff;
427
    //! Mow much higher the stack size can be during execution compared to at the end.
428
    const int32_t exec;
429
430
    /** Empty script set. */
431
0
    constexpr SatInfo() noexcept : valid(false), netdiff(0), exec(0) {}
432
433
    /** Script set with a single script in it, with specified netdiff and exec. */
434
    constexpr SatInfo(int32_t in_netdiff, int32_t in_exec) noexcept :
435
0
        valid{true}, netdiff{in_netdiff}, exec{in_exec} {}
436
437
    /** Script set union. */
438
    constexpr friend SatInfo operator|(const SatInfo& a, const SatInfo& b) noexcept
439
0
    {
440
        // Union with an empty set is itself.
441
0
        if (!a.valid) return b;
  Branch (441:13): [True: 0, False: 0]
442
0
        if (!b.valid) return a;
  Branch (442:13): [True: 0, False: 0]
443
        // Otherwise the netdiff and exec of the union is the maximum of the individual values.
444
0
        return {std::max(a.netdiff, b.netdiff), std::max(a.exec, b.exec)};
445
0
    }
446
447
    /** Script set concatenation. */
448
    constexpr friend SatInfo operator+(const SatInfo& a, const SatInfo& b) noexcept
449
0
    {
450
        // Concatenation with an empty set yields an empty set.
451
0
        if (!a.valid || !b.valid) return {};
  Branch (451:13): [True: 0, False: 0]
  Branch (451:25): [True: 0, False: 0]
452
        // Otherwise, the maximum stack size difference for the combined scripts is the sum of the
453
        // netdiffs, and the maximum stack size difference anywhere is either b.exec (if the
454
        // maximum occurred in b) or b.netdiff+a.exec (if the maximum occurred in a).
455
0
        return {a.netdiff + b.netdiff, std::max(b.exec, b.netdiff + a.exec)};
456
0
    }
457
458
    /** The empty script. */
459
0
    static constexpr SatInfo Empty() noexcept { return {0, 0}; }
460
    /** A script consisting of a single push opcode. */
461
0
    static constexpr SatInfo Push() noexcept { return {-1, 0}; }
462
    /** A script consisting of a single hash opcode. */
463
0
    static constexpr SatInfo Hash() noexcept { return {0, 0}; }
464
    /** A script consisting of just a repurposed nop (OP_CHECKLOCKTIMEVERIFY, OP_CHECKSEQUENCEVERIFY). */
465
0
    static constexpr SatInfo Nop() noexcept { return {0, 0}; }
466
    /** A script consisting of just OP_IF or OP_NOTIF. Note that OP_ELSE and OP_ENDIF have no stack effect. */
467
0
    static constexpr SatInfo If() noexcept { return {1, 1}; }
468
    /** A script consisting of just a binary operator (OP_BOOLAND, OP_BOOLOR, OP_ADD). */
469
0
    static constexpr SatInfo BinaryOp() noexcept { return {1, 1}; }
470
471
    // Scripts for specific individual opcodes.
472
0
    static constexpr SatInfo OP_DUP() noexcept { return {-1, 0}; }
473
0
    static constexpr SatInfo OP_IFDUP(bool nonzero) noexcept { return {nonzero ? -1 : 0, 0}; }
  Branch (473:72): [True: 0, False: 0]
474
0
    static constexpr SatInfo OP_EQUALVERIFY() noexcept { return {2, 2}; }
475
0
    static constexpr SatInfo OP_EQUAL() noexcept { return {1, 1}; }
476
0
    static constexpr SatInfo OP_SIZE() noexcept { return {-1, 0}; }
477
0
    static constexpr SatInfo OP_CHECKSIG() noexcept { return {1, 1}; }
478
0
    static constexpr SatInfo OP_0NOTEQUAL() noexcept { return {0, 0}; }
479
0
    static constexpr SatInfo OP_VERIFY() noexcept { return {1, 1}; }
480
};
481
482
struct StackSize {
483
    const SatInfo sat, dsat;
484
485
0
    constexpr StackSize(SatInfo in_sat, SatInfo in_dsat) noexcept : sat(in_sat), dsat(in_dsat) {};
486
0
    constexpr StackSize(SatInfo in_both) noexcept : sat(in_both), dsat(in_both) {};
487
};
488
489
struct WitnessSize {
490
    //! Maximum witness size to satisfy;
491
    MaxInt<uint32_t> sat;
492
    //! Maximum witness size to dissatisfy;
493
    MaxInt<uint32_t> dsat;
494
495
0
    WitnessSize(MaxInt<uint32_t> in_sat, MaxInt<uint32_t> in_dsat) : sat(in_sat), dsat(in_dsat) {};
496
};
497
498
struct NoDupCheck {};
499
500
} // namespace internal
501
502
//! A node in a miniscript expression.
503
template<typename Key>
504
struct Node {
505
    //! What node type this node is.
506
    const Fragment fragment;
507
    //! The k parameter (time for OLDER/AFTER, threshold for THRESH(_M))
508
    const uint32_t k = 0;
509
    //! The keys used by this expression (only for PK_K/PK_H/MULTI)
510
    const std::vector<Key> keys;
511
    //! The data bytes in this expression (only for HASH160/HASH256/SHA256/RIPEMD10).
512
    const std::vector<unsigned char> data;
513
    //! Subexpressions (for WRAP_*/AND_*/OR_*/ANDOR/THRESH)
514
    mutable std::vector<NodeRef<Key>> subs;
515
    //! The Script context for this node. Either P2WSH or Tapscript.
516
    const MiniscriptContext m_script_ctx;
517
518
    /* Destroy the shared pointers iteratively to avoid a stack-overflow due to recursive calls
519
     * to the subs' destructors. */
520
0
    ~Node() {
521
0
        while (!subs.empty()) {
  Branch (521:16): [True: 0, False: 0]
  Branch (521:16): [True: 0, False: 0]
  Branch (521:16): [True: 0, False: 0]
522
0
            auto node = std::move(subs.back());
523
0
            subs.pop_back();
524
0
            while (!node->subs.empty()) {
  Branch (524:20): [True: 0, False: 0]
  Branch (524:20): [True: 0, False: 0]
  Branch (524:20): [True: 0, False: 0]
525
0
                subs.push_back(std::move(node->subs.back()));
526
0
                node->subs.pop_back();
527
0
            }
528
0
        }
529
0
    }
Unexecuted instantiation: miniscript::Node<unsigned int>::~Node()
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::~Node()
Unexecuted instantiation: miniscript::Node<CPubKey>::~Node()
530
531
    NodeRef<Key> Clone() const
532
0
    {
533
        // Use TreeEval() to avoid a stack-overflow due to recursion
534
0
        auto upfn = [](const Node& node, std::span<NodeRef<Key>> children) {
535
0
            std::vector<NodeRef<Key>> new_subs;
536
0
            for (auto child = children.begin(); child != children.end(); ++child) {
  Branch (536:49): [True: 0, False: 0]
537
0
                new_subs.emplace_back(std::move(*child));
538
0
            }
539
            // std::make_unique (and therefore MakeNodeRef) doesn't work on private constructors
540
0
            return std::unique_ptr<Node>{new Node{internal::NoDupCheck{}, node.m_script_ctx, node.fragment, std::move(new_subs), node.keys, node.data, node.k}};
541
0
        };
542
0
        return TreeEval<NodeRef<Key>>(upfn);
543
0
    }
544
545
private:
546
    //! Cached ops counts.
547
    const internal::Ops ops;
548
    //! Cached stack size bounds.
549
    const internal::StackSize ss;
550
    //! Cached witness size bounds.
551
    const internal::WitnessSize ws;
552
    //! Cached expression type (computed by CalcType and fed through SanitizeType).
553
    const Type typ;
554
    //! Cached script length (computed by CalcScriptLen).
555
    const size_t scriptlen;
556
    //! Whether a public key appears more than once in this node. This value is initialized
557
    //! by all constructors except the NoDupCheck ones. The NoDupCheck ones skip the
558
    //! computation, requiring it to be done manually by invoking DuplicateKeyCheck().
559
    //! DuplicateKeyCheck(), or a non-NoDupCheck constructor, will compute has_duplicate_keys
560
    //! for all subnodes as well.
561
    mutable std::optional<bool> has_duplicate_keys;
562
563
    // Constructor which takes all of the data that a Node could possibly contain.
564
    // This is kept private as no valid fragment has all of these arguments.
565
    // Only used by Clone()
566
    Node(internal::NoDupCheck, MiniscriptContext script_ctx, Fragment nt, std::vector<NodeRef<Key>> sub, std::vector<Key> key, std::vector<unsigned char> arg, uint32_t val)
567
0
        : fragment(nt), k(val), keys(key), data(std::move(arg)), subs(std::move(sub)), m_script_ctx{script_ctx}, ops(CalcOps()), ss(CalcStackSize()), ws(CalcWitnessSize()), typ(CalcType()), scriptlen(CalcScriptLen()) {}
568
569
    //! Compute the length of the script for this miniscript (including children).
570
0
    size_t CalcScriptLen() const {
571
0
        size_t subsize = 0;
572
0
        for (const auto& sub : subs) {
  Branch (572:30): [True: 0, False: 0]
  Branch (572:30): [True: 0, False: 0]
  Branch (572:30): [True: 0, False: 0]
573
0
            subsize += sub->ScriptSize();
574
0
        }
575
0
        static constexpr auto NONE_MST{""_mst};
576
0
        Type sub0type = subs.size() > 0 ? subs[0]->GetType() : NONE_MST;
  Branch (576:25): [True: 0, False: 0]
  Branch (576:25): [True: 0, False: 0]
  Branch (576:25): [True: 0, False: 0]
577
0
        return internal::ComputeScriptLen(fragment, sub0type, subsize, k, subs.size(), keys.size(), m_script_ctx);
578
0
    }
Unexecuted instantiation: miniscript::Node<unsigned int>::CalcScriptLen() const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::CalcScriptLen() const
Unexecuted instantiation: miniscript::Node<CPubKey>::CalcScriptLen() const
579
580
    /* Apply a recursive algorithm to a Miniscript tree, without actual recursive calls.
581
     *
582
     * The algorithm is defined by two functions: downfn and upfn. Conceptually, the
583
     * result can be thought of as first using downfn to compute a "state" for each node,
584
     * from the root down to the leaves. Then upfn is used to compute a "result" for each
585
     * node, from the leaves back up to the root, which is then returned. In the actual
586
     * implementation, both functions are invoked in an interleaved fashion, performing a
587
     * depth-first traversal of the tree.
588
     *
589
     * In more detail, it is invoked as node.TreeEvalMaybe<Result>(root, downfn, upfn):
590
     * - root is the state of the root node, of type State.
591
     * - downfn is a callable (State&, const Node&, size_t) -> State, which given a
592
     *   node, its state, and an index of one of its children, computes the state of that
593
     *   child. It can modify the state. Children of a given node will have downfn()
594
     *   called in order.
595
     * - upfn is a callable (State&&, const Node&, std::span<Result>) -> std::optional<Result>,
596
     *   which given a node, its state, and a span of the results of its children,
597
     *   computes the result of the node. If std::nullopt is returned by upfn,
598
     *   TreeEvalMaybe() immediately returns std::nullopt.
599
     * The return value of TreeEvalMaybe is the result of the root node.
600
     *
601
     * Result type cannot be bool due to the std::vector<bool> specialization.
602
     */
603
    template<typename Result, typename State, typename DownFn, typename UpFn>
604
    std::optional<Result> TreeEvalMaybe(State root_state, DownFn downfn, UpFn upfn) const
605
0
    {
606
        /** Entries of the explicit stack tracked in this algorithm. */
607
0
        struct StackElem
608
0
        {
609
0
            const Node& node; //!< The node being evaluated.
610
0
            size_t expanded; //!< How many children of this node have been expanded.
611
0
            State state; //!< The state for that node.
612
613
0
            StackElem(const Node& node_, size_t exp_, State&& state_) :
614
0
                node(node_), expanded(exp_), state(std::move(state_)) {}
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::TreeEvalMaybe<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::StackElem::StackElem(miniscript::Node<unsigned int> const&, unsigned long, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::DummyState&&)
Unexecuted instantiation: miniscript::Node<unsigned int>::TreeEvalMaybe<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::StackElem::StackElem(miniscript::Node<unsigned int> const&, unsigned long, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::DummyState&&)
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::TreeEvalMaybe<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>)#1}>(bool, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>)#1}) const::StackElem::StackElem(miniscript::Node<unsigned int> const&, unsigned long, bool&&)
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::TreeEvalMaybe<CScript, bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<CScript, bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}&, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}>(bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}&, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}) const::{lambda(bool&&, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}>(bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<CScript, bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}&, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}>(bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}&, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}) const::{lambda(bool&&, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}) const::StackElem::StackElem(miniscript::Node<unsigned int> const&, unsigned long, bool&&)
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::TreeEvalMaybe<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>)#1}>(bool, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>)#1}) const::StackElem::StackElem(miniscript::Node<unsigned int> const&, unsigned long, bool&&)
Unexecuted instantiation: miniscript::Node<unsigned int>::TreeEvalMaybe<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::StackElem::StackElem(miniscript::Node<unsigned int> const&, unsigned long, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::DummyState&&)
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::TreeEvalMaybe<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long)#1}, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long)#1}, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::StackElem::StackElem(miniscript::Node<XOnlyPubKey> const&, unsigned long, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState&&)
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::TreeEvalMaybe<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long)#1}, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long)#1}, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}) const::StackElem::StackElem(miniscript::Node<XOnlyPubKey> const&, unsigned long, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState&&)
Unexecuted instantiation: miniscript::Node<CPubKey>::TreeEvalMaybe<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long)#1}, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long)#1}, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::StackElem::StackElem(miniscript::Node<CPubKey> const&, unsigned long, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState&&)
Unexecuted instantiation: miniscript::Node<CPubKey>::TreeEvalMaybe<miniscript::internal::InputResult, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long)#1}, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long)#1}, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}) const::StackElem::StackElem(miniscript::Node<CPubKey> const&, unsigned long, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState&&)
615
0
        };
616
        /* Stack of tree nodes being explored. */
617
0
        std::vector<StackElem> stack;
618
        /* Results of subtrees so far. Their order and mapping to tree nodes
619
         * is implicitly defined by stack. */
620
0
        std::vector<Result> results;
621
0
        stack.emplace_back(*this, 0, std::move(root_state));
622
623
        /* Here is a demonstration of the algorithm, for an example tree A(B,C(D,E),F).
624
         * State variables are omitted for simplicity.
625
         *
626
         * First: stack=[(A,0)] results=[]
627
         *        stack=[(A,1),(B,0)] results=[]
628
         *        stack=[(A,1)] results=[B]
629
         *        stack=[(A,2),(C,0)] results=[B]
630
         *        stack=[(A,2),(C,1),(D,0)] results=[B]
631
         *        stack=[(A,2),(C,1)] results=[B,D]
632
         *        stack=[(A,2),(C,2),(E,0)] results=[B,D]
633
         *        stack=[(A,2),(C,2)] results=[B,D,E]
634
         *        stack=[(A,2)] results=[B,C]
635
         *        stack=[(A,3),(F,0)] results=[B,C]
636
         *        stack=[(A,3)] results=[B,C,F]
637
         * Final: stack=[] results=[A]
638
         */
639
0
        while (stack.size()) {
  Branch (639:16): [True: 0, False: 0]
  Branch (639:16): [True: 0, False: 0]
  Branch (639:16): [True: 0, False: 0]
  Branch (639:16): [True: 0, False: 0]
  Branch (639:16): [True: 0, False: 0]
  Branch (639:16): [True: 0, False: 0]
  Branch (639:16): [True: 0, False: 0]
  Branch (639:16): [True: 0, False: 0]
  Branch (639:16): [True: 0, False: 0]
  Branch (639:16): [True: 0, False: 0]
640
0
            const Node& node = stack.back().node;
641
0
            if (stack.back().expanded < node.subs.size()) {
  Branch (641:17): [True: 0, False: 0]
  Branch (641:17): [True: 0, False: 0]
  Branch (641:17): [True: 0, False: 0]
  Branch (641:17): [True: 0, False: 0]
  Branch (641:17): [True: 0, False: 0]
  Branch (641:17): [True: 0, False: 0]
  Branch (641:17): [True: 0, False: 0]
  Branch (641:17): [True: 0, False: 0]
  Branch (641:17): [True: 0, False: 0]
  Branch (641:17): [True: 0, False: 0]
642
                /* We encounter a tree node with at least one unexpanded child.
643
                 * Expand it. By the time we hit this node again, the result of
644
                 * that child (and all earlier children) will be at the end of `results`. */
645
0
                size_t child_index = stack.back().expanded++;
646
0
                State child_state = downfn(stack.back().state, node, child_index);
647
0
                stack.emplace_back(*node.subs[child_index], 0, std::move(child_state));
648
0
                continue;
649
0
            }
650
            // Invoke upfn with the last node.subs.size() elements of results as input.
651
0
            assert(results.size() >= node.subs.size());
  Branch (651:13): [True: 0, False: 0]
  Branch (651:13): [True: 0, False: 0]
  Branch (651:13): [True: 0, False: 0]
  Branch (651:13): [True: 0, False: 0]
  Branch (651:13): [True: 0, False: 0]
  Branch (651:13): [True: 0, False: 0]
  Branch (651:13): [True: 0, False: 0]
  Branch (651:13): [True: 0, False: 0]
  Branch (651:13): [True: 0, False: 0]
  Branch (651:13): [True: 0, False: 0]
652
0
            std::optional<Result> result{upfn(std::move(stack.back().state), node,
653
0
                std::span<Result>{results}.last(node.subs.size()))};
654
            // If evaluation returns std::nullopt, abort immediately.
655
0
            if (!result) return {};
  Branch (655:17): [True: 0, False: 0]
  Branch (655:17): [True: 0, False: 0]
  Branch (655:17): [True: 0, False: 0]
  Branch (655:17): [True: 0, False: 0]
  Branch (655:17): [True: 0, False: 0]
  Branch (655:17): [True: 0, False: 0]
  Branch (655:17): [True: 0, False: 0]
  Branch (655:17): [True: 0, False: 0]
  Branch (655:17): [True: 0, False: 0]
  Branch (655:17): [True: 0, False: 0]
656
            // Replace the last node.subs.size() elements of results with the new result.
657
0
            results.erase(results.end() - node.subs.size(), results.end());
658
0
            results.push_back(std::move(*result));
659
0
            stack.pop_back();
660
0
        }
661
        // The final remaining results element is the root result, return it.
662
0
        assert(results.size() >= 1);
  Branch (662:9): [True: 0, False: 0]
  Branch (662:9): [True: 0, False: 0]
  Branch (662:9): [True: 0, False: 0]
  Branch (662:9): [True: 0, False: 0]
  Branch (662:9): [True: 0, False: 0]
  Branch (662:9): [True: 0, False: 0]
  Branch (662:9): [True: 0, False: 0]
  Branch (662:9): [True: 0, False: 0]
  Branch (662:9): [True: 0, False: 0]
  Branch (662:9): [True: 0, False: 0]
663
0
        CHECK_NONFATAL(results.size() == 1);
664
0
        return std::move(results[0]);
665
0
    }
Unexecuted instantiation: descriptor.cpp:std::optional<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > > > miniscript::Node<unsigned int>::TreeEvalMaybe<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: std::optional<miniscript::Node<unsigned int> const*> miniscript::Node<unsigned int>::TreeEvalMaybe<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: descriptor.cpp:std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > miniscript::Node<unsigned int>::TreeEvalMaybe<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>)#1}>(bool, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: descriptor.cpp:std::optional<CScript> miniscript::Node<unsigned int>::TreeEvalMaybe<CScript, bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<CScript, bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}&, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}>(bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}&, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}) const::{lambda(bool&&, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}>(bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<CScript, bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}&, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}>(bool, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}&, miniscript::Node<unsigned int>::ToScript<(anonymous namespace)::ScriptMaker>((anonymous namespace)::ScriptMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}) const::{lambda(bool&&, miniscript::Node<unsigned int> const&, std::span<CScript, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: descriptor.cpp:std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > miniscript::Node<unsigned int>::TreeEvalMaybe<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>)#1}>(bool, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: std::optional<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > > miniscript::Node<unsigned int>::TreeEvalMaybe<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}, miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: std::optional<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > > > miniscript::Node<XOnlyPubKey>::TreeEvalMaybe<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long)#1}, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long)#1}, miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: std::optional<miniscript::internal::InputResult> miniscript::Node<XOnlyPubKey>::TreeEvalMaybe<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long)#1}, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long)#1}, miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: std::optional<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > > > miniscript::Node<CPubKey>::TreeEvalMaybe<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long)#1}, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long)#1}, miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: std::optional<miniscript::internal::InputResult> miniscript::Node<CPubKey>::TreeEvalMaybe<miniscript::internal::InputResult, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long)#1}, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long)#1}, miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}) const
666
667
    /** Like TreeEvalMaybe, but without downfn or State type.
668
     * upfn takes (const Node&, std::span<Result>) and returns std::optional<Result>. */
669
    template<typename Result, typename UpFn>
670
    std::optional<Result> TreeEvalMaybe(UpFn upfn) const
671
    {
672
        struct DummyState {};
673
        return TreeEvalMaybe<Result>(DummyState{},
674
            [](DummyState, const Node&, size_t) { return DummyState{}; },
675
            [&upfn](DummyState, const Node& node, std::span<Result> subs) {
676
                return upfn(node, subs);
677
            }
678
        );
679
    }
680
681
    /** Like TreeEvalMaybe, but always produces a result. upfn must return Result. */
682
    template<typename Result, typename State, typename DownFn, typename UpFn>
683
    Result TreeEval(State root_state, DownFn&& downfn, UpFn upfn) const
684
0
    {
685
        // Invoke TreeEvalMaybe with upfn wrapped to return std::optional<Result>, and then
686
        // unconditionally dereference the result (it cannot be std::nullopt).
687
0
        return std::move(*TreeEvalMaybe<Result>(std::move(root_state),
688
0
            std::forward<DownFn>(downfn),
689
0
            [&upfn](State&& state, const Node& node, std::span<Result> subs) {
690
0
                Result res{upfn(std::move(state), node, subs)};
691
0
                return std::optional<Result>(std::move(res));
692
0
            }
693
0
        ));
694
0
    }
695
696
    /** Like TreeEval, but without downfn or State type.
697
     *  upfn takes (const Node&, std::span<Result>) and returns Result. */
698
    template<typename Result, typename UpFn>
699
    Result TreeEval(UpFn upfn) const
700
0
    {
701
0
        struct DummyState {};
702
0
        return std::move(*TreeEvalMaybe<Result>(DummyState{},
703
0
            [](DummyState, const Node&, size_t) { return DummyState{}; },
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}::operator()(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long) const
Unexecuted instantiation: miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}::operator()(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long) const
Unexecuted instantiation: miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long)#1}::operator()(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int> const&, unsigned long) const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long)#1}::operator()(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long) const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long)#1}::operator()(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<XOnlyPubKey> const&, unsigned long) const
Unexecuted instantiation: miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long)#1}::operator()(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long) const
Unexecuted instantiation: miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long)#1}::operator()(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<CPubKey> const&, unsigned long) const
704
0
            [&upfn](DummyState, const Node& node, std::span<Result> subs) {
705
0
                Result res{upfn(node, subs)};
706
0
                return std::optional<Result>(std::move(res));
707
0
            }
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}::operator()(miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>) const
Unexecuted instantiation: miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}::operator()(miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>) const
Unexecuted instantiation: miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}::operator()(miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>) const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}::operator()(miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>) const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}::operator()(miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>) const
Unexecuted instantiation: miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}::operator()(miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const::DummyState, miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>) const
Unexecuted instantiation: miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::{lambda(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(auto:1 const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(auto:2) const::DummyState, miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}::operator()(miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const::DummyState, miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>) const
708
0
        ));
709
0
    }
Unexecuted instantiation: descriptor.cpp:std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > > miniscript::Node<unsigned int>::TreeEval<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: miniscript::Node<unsigned int> const* miniscript::Node<unsigned int>::TreeEval<miniscript::Node<unsigned int> const*, miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::FindInsaneSub() const::{lambda(miniscript::Node<unsigned int> const&, std::span<miniscript::Node<unsigned int> const*, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::Node<unsigned int>::TreeEval<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}>(miniscript::Node<unsigned int>::Clone() const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > > miniscript::Node<XOnlyPubKey>::TreeEval<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: miniscript::internal::InputResult miniscript::Node<XOnlyPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const
Unexecuted instantiation: std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > > miniscript::Node<CPubKey>::TreeEval<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}>(miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}) const
Unexecuted instantiation: miniscript::internal::InputResult miniscript::Node<CPubKey>::TreeEval<miniscript::internal::InputResult, miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}>(miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}) const
710
711
    /** Compare two miniscript subtrees, using a non-recursive algorithm. */
712
    friend int Compare(const Node<Key>& node1, const Node<Key>& node2)
713
    {
714
        std::vector<std::pair<const Node<Key>&, const Node<Key>&>> queue;
715
        queue.emplace_back(node1, node2);
716
        while (!queue.empty()) {
717
            const auto& [a, b] = queue.back();
718
            queue.pop_back();
719
            if (std::tie(a.fragment, a.k, a.keys, a.data) < std::tie(b.fragment, b.k, b.keys, b.data)) return -1;
720
            if (std::tie(b.fragment, b.k, b.keys, b.data) < std::tie(a.fragment, a.k, a.keys, a.data)) return 1;
721
            if (a.subs.size() < b.subs.size()) return -1;
722
            if (b.subs.size() < a.subs.size()) return 1;
723
            size_t n = a.subs.size();
724
            for (size_t i = 0; i < n; ++i) {
725
                queue.emplace_back(*a.subs[n - 1 - i], *b.subs[n - 1 - i]);
726
            }
727
        }
728
        return 0;
729
    }
730
731
    //! Compute the type for this miniscript.
732
0
    Type CalcType() const {
733
0
        using namespace internal;
734
735
        // THRESH has a variable number of subexpressions
736
0
        std::vector<Type> sub_types;
737
0
        if (fragment == Fragment::THRESH) {
  Branch (737:13): [True: 0, False: 0]
  Branch (737:13): [True: 0, False: 0]
  Branch (737:13): [True: 0, False: 0]
738
0
            for (const auto& sub : subs) sub_types.push_back(sub->GetType());
  Branch (738:34): [True: 0, False: 0]
  Branch (738:34): [True: 0, False: 0]
  Branch (738:34): [True: 0, False: 0]
739
0
        }
740
        // All other nodes than THRESH can be computed just from the types of the 0-3 subexpressions.
741
0
        static constexpr auto NONE_MST{""_mst};
742
0
        Type x = subs.size() > 0 ? subs[0]->GetType() : NONE_MST;
  Branch (742:18): [True: 0, False: 0]
  Branch (742:18): [True: 0, False: 0]
  Branch (742:18): [True: 0, False: 0]
743
0
        Type y = subs.size() > 1 ? subs[1]->GetType() : NONE_MST;
  Branch (743:18): [True: 0, False: 0]
  Branch (743:18): [True: 0, False: 0]
  Branch (743:18): [True: 0, False: 0]
744
0
        Type z = subs.size() > 2 ? subs[2]->GetType() : NONE_MST;
  Branch (744:18): [True: 0, False: 0]
  Branch (744:18): [True: 0, False: 0]
  Branch (744:18): [True: 0, False: 0]
745
746
0
        return SanitizeType(ComputeType(fragment, x, y, z, sub_types, k, data.size(), subs.size(), keys.size(), m_script_ctx));
747
0
    }
Unexecuted instantiation: miniscript::Node<unsigned int>::CalcType() const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::CalcType() const
Unexecuted instantiation: miniscript::Node<CPubKey>::CalcType() const
748
749
public:
750
    template<typename Ctx>
751
    CScript ToScript(const Ctx& ctx) const
752
0
    {
753
        // To construct the CScript for a Miniscript object, we use the TreeEval algorithm.
754
        // The State is a boolean: whether or not the node's script expansion is followed
755
        // by an OP_VERIFY (which may need to be combined with the last script opcode).
756
0
        auto downfn = [](bool verify, const Node& node, size_t index) {
757
            // For WRAP_V, the subexpression is certainly followed by OP_VERIFY.
758
0
            if (node.fragment == Fragment::WRAP_V) return true;
  Branch (758:17): [True: 0, False: 0]
759
            // The subexpression of WRAP_S, and the last subexpression of AND_V
760
            // inherit the followed-by-OP_VERIFY property from the parent.
761
0
            if (node.fragment == Fragment::WRAP_S ||
  Branch (761:17): [True: 0, False: 0]
762
0
                (node.fragment == Fragment::AND_V && index == 1)) return verify;
  Branch (762:18): [True: 0, False: 0]
  Branch (762:54): [True: 0, False: 0]
763
0
            return false;
764
0
        };
765
        // The upward function computes for a node, given its followed-by-OP_VERIFY status
766
        // and the CScripts of its child nodes, the CScript of the node.
767
0
        const bool is_tapscript{IsTapscript(m_script_ctx)};
768
0
        auto upfn = [&ctx, is_tapscript](bool verify, const Node& node, std::span<CScript> subs) -> CScript {
769
0
            switch (node.fragment) {
  Branch (769:21): [True: 0, False: 0]
770
0
                case Fragment::PK_K: return BuildScript(ctx.ToPKBytes(node.keys[0]));
  Branch (770:17): [True: 0, False: 0]
771
0
                case Fragment::PK_H: return BuildScript(OP_DUP, OP_HASH160, ctx.ToPKHBytes(node.keys[0]), OP_EQUALVERIFY);
  Branch (771:17): [True: 0, False: 0]
772
0
                case Fragment::OLDER: return BuildScript(node.k, OP_CHECKSEQUENCEVERIFY);
  Branch (772:17): [True: 0, False: 0]
773
0
                case Fragment::AFTER: return BuildScript(node.k, OP_CHECKLOCKTIMEVERIFY);
  Branch (773:17): [True: 0, False: 0]
774
0
                case Fragment::SHA256: return BuildScript(OP_SIZE, 32, OP_EQUALVERIFY, OP_SHA256, node.data, verify ? OP_EQUALVERIFY : OP_EQUAL);
  Branch (774:17): [True: 0, False: 0]
  Branch (774:110): [True: 0, False: 0]
775
0
                case Fragment::RIPEMD160: return BuildScript(OP_SIZE, 32, OP_EQUALVERIFY, OP_RIPEMD160, node.data, verify ? OP_EQUALVERIFY : OP_EQUAL);
  Branch (775:17): [True: 0, False: 0]
  Branch (775:116): [True: 0, False: 0]
776
0
                case Fragment::HASH256: return BuildScript(OP_SIZE, 32, OP_EQUALVERIFY, OP_HASH256, node.data, verify ? OP_EQUALVERIFY : OP_EQUAL);
  Branch (776:17): [True: 0, False: 0]
  Branch (776:112): [True: 0, False: 0]
777
0
                case Fragment::HASH160: return BuildScript(OP_SIZE, 32, OP_EQUALVERIFY, OP_HASH160, node.data, verify ? OP_EQUALVERIFY : OP_EQUAL);
  Branch (777:17): [True: 0, False: 0]
  Branch (777:112): [True: 0, False: 0]
778
0
                case Fragment::WRAP_A: return BuildScript(OP_TOALTSTACK, subs[0], OP_FROMALTSTACK);
  Branch (778:17): [True: 0, False: 0]
779
0
                case Fragment::WRAP_S: return BuildScript(OP_SWAP, subs[0]);
  Branch (779:17): [True: 0, False: 0]
780
0
                case Fragment::WRAP_C: return BuildScript(std::move(subs[0]), verify ? OP_CHECKSIGVERIFY : OP_CHECKSIG);
  Branch (780:17): [True: 0, False: 0]
  Branch (780:79): [True: 0, False: 0]
781
0
                case Fragment::WRAP_D: return BuildScript(OP_DUP, OP_IF, subs[0], OP_ENDIF);
  Branch (781:17): [True: 0, False: 0]
782
0
                case Fragment::WRAP_V: {
  Branch (782:17): [True: 0, False: 0]
783
0
                    if (node.subs[0]->GetType() << "x"_mst) {
  Branch (783:25): [True: 0, False: 0]
784
0
                        return BuildScript(std::move(subs[0]), OP_VERIFY);
785
0
                    } else {
786
0
                        return std::move(subs[0]);
787
0
                    }
788
0
                }
789
0
                case Fragment::WRAP_J: return BuildScript(OP_SIZE, OP_0NOTEQUAL, OP_IF, subs[0], OP_ENDIF);
  Branch (789:17): [True: 0, False: 0]
790
0
                case Fragment::WRAP_N: return BuildScript(std::move(subs[0]), OP_0NOTEQUAL);
  Branch (790:17): [True: 0, False: 0]
791
0
                case Fragment::JUST_1: return BuildScript(OP_1);
  Branch (791:17): [True: 0, False: 0]
792
0
                case Fragment::JUST_0: return BuildScript(OP_0);
  Branch (792:17): [True: 0, False: 0]
793
0
                case Fragment::AND_V: return BuildScript(std::move(subs[0]), subs[1]);
  Branch (793:17): [True: 0, False: 0]
794
0
                case Fragment::AND_B: return BuildScript(std::move(subs[0]), subs[1], OP_BOOLAND);
  Branch (794:17): [True: 0, False: 0]
795
0
                case Fragment::OR_B: return BuildScript(std::move(subs[0]), subs[1], OP_BOOLOR);
  Branch (795:17): [True: 0, False: 0]
796
0
                case Fragment::OR_D: return BuildScript(std::move(subs[0]), OP_IFDUP, OP_NOTIF, subs[1], OP_ENDIF);
  Branch (796:17): [True: 0, False: 0]
797
0
                case Fragment::OR_C: return BuildScript(std::move(subs[0]), OP_NOTIF, subs[1], OP_ENDIF);
  Branch (797:17): [True: 0, False: 0]
798
0
                case Fragment::OR_I: return BuildScript(OP_IF, subs[0], OP_ELSE, subs[1], OP_ENDIF);
  Branch (798:17): [True: 0, False: 0]
799
0
                case Fragment::ANDOR: return BuildScript(std::move(subs[0]), OP_NOTIF, subs[2], OP_ELSE, subs[1], OP_ENDIF);
  Branch (799:17): [True: 0, False: 0]
800
0
                case Fragment::MULTI: {
  Branch (800:17): [True: 0, False: 0]
801
0
                    CHECK_NONFATAL(!is_tapscript);
802
0
                    CScript script = BuildScript(node.k);
803
0
                    for (const auto& key : node.keys) {
  Branch (803:42): [True: 0, False: 0]
804
0
                        script = BuildScript(std::move(script), ctx.ToPKBytes(key));
805
0
                    }
806
0
                    return BuildScript(std::move(script), node.keys.size(), verify ? OP_CHECKMULTISIGVERIFY : OP_CHECKMULTISIG);
  Branch (806:77): [True: 0, False: 0]
807
0
                }
808
0
                case Fragment::MULTI_A: {
  Branch (808:17): [True: 0, False: 0]
809
0
                    CHECK_NONFATAL(is_tapscript);
810
0
                    CScript script = BuildScript(ctx.ToPKBytes(*node.keys.begin()), OP_CHECKSIG);
811
0
                    for (auto it = node.keys.begin() + 1; it != node.keys.end(); ++it) {
  Branch (811:59): [True: 0, False: 0]
812
0
                        script = BuildScript(std::move(script), ctx.ToPKBytes(*it), OP_CHECKSIGADD);
813
0
                    }
814
0
                    return BuildScript(std::move(script), node.k, verify ? OP_NUMEQUALVERIFY : OP_NUMEQUAL);
  Branch (814:67): [True: 0, False: 0]
815
0
                }
816
0
                case Fragment::THRESH: {
  Branch (816:17): [True: 0, False: 0]
817
0
                    CScript script = std::move(subs[0]);
818
0
                    for (size_t i = 1; i < subs.size(); ++i) {
  Branch (818:40): [True: 0, False: 0]
819
0
                        script = BuildScript(std::move(script), subs[i], OP_ADD);
820
0
                    }
821
0
                    return BuildScript(std::move(script), node.k, verify ? OP_EQUALVERIFY : OP_EQUAL);
  Branch (821:67): [True: 0, False: 0]
822
0
                }
823
0
            }
824
0
            assert(false);
  Branch (824:13): [Folded - Ignored]
825
0
        };
826
0
        return TreeEval<CScript>(false, downfn, upfn);
827
0
    }
828
829
    template<typename CTx>
830
0
    std::optional<std::string> ToString(const CTx& ctx) const {
831
        // To construct the std::string representation for a Miniscript object, we use
832
        // the TreeEvalMaybe algorithm. The State is a boolean: whether the parent node is a
833
        // wrapper. If so, non-wrapper expressions must be prefixed with a ":".
834
0
        auto downfn = [](bool, const Node& node, size_t) {
835
0
            return (node.fragment == Fragment::WRAP_A || node.fragment == Fragment::WRAP_S ||
  Branch (835:21): [True: 0, False: 0]
  Branch (835:58): [True: 0, False: 0]
  Branch (835:21): [True: 0, False: 0]
  Branch (835:58): [True: 0, False: 0]
836
0
                    node.fragment == Fragment::WRAP_D || node.fragment == Fragment::WRAP_V ||
  Branch (836:21): [True: 0, False: 0]
  Branch (836:58): [True: 0, False: 0]
  Branch (836:21): [True: 0, False: 0]
  Branch (836:58): [True: 0, False: 0]
837
0
                    node.fragment == Fragment::WRAP_J || node.fragment == Fragment::WRAP_N ||
  Branch (837:21): [True: 0, False: 0]
  Branch (837:58): [True: 0, False: 0]
  Branch (837:21): [True: 0, False: 0]
  Branch (837:58): [True: 0, False: 0]
838
0
                    node.fragment == Fragment::WRAP_C ||
  Branch (838:21): [True: 0, False: 0]
  Branch (838:21): [True: 0, False: 0]
839
0
                    (node.fragment == Fragment::AND_V && node.subs[1]->fragment == Fragment::JUST_1) ||
  Branch (839:22): [True: 0, False: 0]
  Branch (839:58): [True: 0, False: 0]
  Branch (839:22): [True: 0, False: 0]
  Branch (839:58): [True: 0, False: 0]
840
0
                    (node.fragment == Fragment::OR_I && node.subs[0]->fragment == Fragment::JUST_0) ||
  Branch (840:22): [True: 0, False: 0]
  Branch (840:57): [True: 0, False: 0]
  Branch (840:22): [True: 0, False: 0]
  Branch (840:57): [True: 0, False: 0]
841
0
                    (node.fragment == Fragment::OR_I && node.subs[1]->fragment == Fragment::JUST_0));
  Branch (841:22): [True: 0, False: 0]
  Branch (841:57): [True: 0, False: 0]
  Branch (841:22): [True: 0, False: 0]
  Branch (841:57): [True: 0, False: 0]
842
0
        };
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}::operator()(bool, miniscript::Node<unsigned int> const&, unsigned long) const
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, unsigned long)#1}::operator()(bool, miniscript::Node<unsigned int> const&, unsigned long) const
843
        // The upward function computes for a node, given whether its parent is a wrapper,
844
        // and the string representations of its child nodes, the string representation of the node.
845
0
        const bool is_tapscript{IsTapscript(m_script_ctx)};
846
0
        auto upfn = [&ctx, is_tapscript](bool wrapped, const Node& node, std::span<std::string> subs) -> std::optional<std::string> {
847
0
            std::string ret = wrapped ? ":" : "";
  Branch (847:31): [True: 0, False: 0]
  Branch (847:31): [True: 0, False: 0]
848
849
0
            switch (node.fragment) {
850
0
                case Fragment::WRAP_A: return "a" + std::move(subs[0]);
  Branch (850:17): [True: 0, False: 0]
  Branch (850:17): [True: 0, False: 0]
851
0
                case Fragment::WRAP_S: return "s" + std::move(subs[0]);
  Branch (851:17): [True: 0, False: 0]
  Branch (851:17): [True: 0, False: 0]
852
0
                case Fragment::WRAP_C:
  Branch (852:17): [True: 0, False: 0]
  Branch (852:17): [True: 0, False: 0]
853
0
                    if (node.subs[0]->fragment == Fragment::PK_K) {
  Branch (853:25): [True: 0, False: 0]
  Branch (853:25): [True: 0, False: 0]
854
                        // pk(K) is syntactic sugar for c:pk_k(K)
855
0
                        auto key_str = ctx.ToString(node.subs[0]->keys[0]);
856
0
                        if (!key_str) return {};
  Branch (856:29): [True: 0, False: 0]
  Branch (856:29): [True: 0, False: 0]
857
0
                        return std::move(ret) + "pk(" + std::move(*key_str) + ")";
858
0
                    }
859
0
                    if (node.subs[0]->fragment == Fragment::PK_H) {
  Branch (859:25): [True: 0, False: 0]
  Branch (859:25): [True: 0, False: 0]
860
                        // pkh(K) is syntactic sugar for c:pk_h(K)
861
0
                        auto key_str = ctx.ToString(node.subs[0]->keys[0]);
862
0
                        if (!key_str) return {};
  Branch (862:29): [True: 0, False: 0]
  Branch (862:29): [True: 0, False: 0]
863
0
                        return std::move(ret) + "pkh(" + std::move(*key_str) + ")";
864
0
                    }
865
0
                    return "c" + std::move(subs[0]);
866
0
                case Fragment::WRAP_D: return "d" + std::move(subs[0]);
  Branch (866:17): [True: 0, False: 0]
  Branch (866:17): [True: 0, False: 0]
867
0
                case Fragment::WRAP_V: return "v" + std::move(subs[0]);
  Branch (867:17): [True: 0, False: 0]
  Branch (867:17): [True: 0, False: 0]
868
0
                case Fragment::WRAP_J: return "j" + std::move(subs[0]);
  Branch (868:17): [True: 0, False: 0]
  Branch (868:17): [True: 0, False: 0]
869
0
                case Fragment::WRAP_N: return "n" + std::move(subs[0]);
  Branch (869:17): [True: 0, False: 0]
  Branch (869:17): [True: 0, False: 0]
870
0
                case Fragment::AND_V:
  Branch (870:17): [True: 0, False: 0]
  Branch (870:17): [True: 0, False: 0]
871
                    // t:X is syntactic sugar for and_v(X,1).
872
0
                    if (node.subs[1]->fragment == Fragment::JUST_1) return "t" + std::move(subs[0]);
  Branch (872:25): [True: 0, False: 0]
  Branch (872:25): [True: 0, False: 0]
873
0
                    break;
874
0
                case Fragment::OR_I:
  Branch (874:17): [True: 0, False: 0]
  Branch (874:17): [True: 0, False: 0]
875
0
                    if (node.subs[0]->fragment == Fragment::JUST_0) return "l" + std::move(subs[1]);
  Branch (875:25): [True: 0, False: 0]
  Branch (875:25): [True: 0, False: 0]
876
0
                    if (node.subs[1]->fragment == Fragment::JUST_0) return "u" + std::move(subs[0]);
  Branch (876:25): [True: 0, False: 0]
  Branch (876:25): [True: 0, False: 0]
877
0
                    break;
878
0
                default: break;
  Branch (878:17): [True: 0, False: 0]
  Branch (878:17): [True: 0, False: 0]
879
0
            }
880
0
            switch (node.fragment) {
881
0
                case Fragment::PK_K: {
  Branch (881:17): [True: 0, False: 0]
  Branch (881:17): [True: 0, False: 0]
882
0
                    auto key_str = ctx.ToString(node.keys[0]);
883
0
                    if (!key_str) return {};
  Branch (883:25): [True: 0, False: 0]
  Branch (883:25): [True: 0, False: 0]
884
0
                    return std::move(ret) + "pk_k(" + std::move(*key_str) + ")";
885
0
                }
886
0
                case Fragment::PK_H: {
  Branch (886:17): [True: 0, False: 0]
  Branch (886:17): [True: 0, False: 0]
887
0
                    auto key_str = ctx.ToString(node.keys[0]);
888
0
                    if (!key_str) return {};
  Branch (888:25): [True: 0, False: 0]
  Branch (888:25): [True: 0, False: 0]
889
0
                    return std::move(ret) + "pk_h(" + std::move(*key_str) + ")";
890
0
                }
891
0
                case Fragment::AFTER: return std::move(ret) + "after(" + util::ToString(node.k) + ")";
  Branch (891:17): [True: 0, False: 0]
  Branch (891:17): [True: 0, False: 0]
892
0
                case Fragment::OLDER: return std::move(ret) + "older(" + util::ToString(node.k) + ")";
  Branch (892:17): [True: 0, False: 0]
  Branch (892:17): [True: 0, False: 0]
893
0
                case Fragment::HASH256: return std::move(ret) + "hash256(" + HexStr(node.data) + ")";
  Branch (893:17): [True: 0, False: 0]
  Branch (893:17): [True: 0, False: 0]
894
0
                case Fragment::HASH160: return std::move(ret) + "hash160(" + HexStr(node.data) + ")";
  Branch (894:17): [True: 0, False: 0]
  Branch (894:17): [True: 0, False: 0]
895
0
                case Fragment::SHA256: return std::move(ret) + "sha256(" + HexStr(node.data) + ")";
  Branch (895:17): [True: 0, False: 0]
  Branch (895:17): [True: 0, False: 0]
896
0
                case Fragment::RIPEMD160: return std::move(ret) + "ripemd160(" + HexStr(node.data) + ")";
  Branch (896:17): [True: 0, False: 0]
  Branch (896:17): [True: 0, False: 0]
897
0
                case Fragment::JUST_1: return std::move(ret) + "1";
  Branch (897:17): [True: 0, False: 0]
  Branch (897:17): [True: 0, False: 0]
898
0
                case Fragment::JUST_0: return std::move(ret) + "0";
  Branch (898:17): [True: 0, False: 0]
  Branch (898:17): [True: 0, False: 0]
899
0
                case Fragment::AND_V: return std::move(ret) + "and_v(" + std::move(subs[0]) + "," + std::move(subs[1]) + ")";
  Branch (899:17): [True: 0, False: 0]
  Branch (899:17): [True: 0, False: 0]
900
0
                case Fragment::AND_B: return std::move(ret) + "and_b(" + std::move(subs[0]) + "," + std::move(subs[1]) + ")";
  Branch (900:17): [True: 0, False: 0]
  Branch (900:17): [True: 0, False: 0]
901
0
                case Fragment::OR_B: return std::move(ret) + "or_b(" + std::move(subs[0]) + "," + std::move(subs[1]) + ")";
  Branch (901:17): [True: 0, False: 0]
  Branch (901:17): [True: 0, False: 0]
902
0
                case Fragment::OR_D: return std::move(ret) + "or_d(" + std::move(subs[0]) + "," + std::move(subs[1]) + ")";
  Branch (902:17): [True: 0, False: 0]
  Branch (902:17): [True: 0, False: 0]
903
0
                case Fragment::OR_C: return std::move(ret) + "or_c(" + std::move(subs[0]) + "," + std::move(subs[1]) + ")";
  Branch (903:17): [True: 0, False: 0]
  Branch (903:17): [True: 0, False: 0]
904
0
                case Fragment::OR_I: return std::move(ret) + "or_i(" + std::move(subs[0]) + "," + std::move(subs[1]) + ")";
  Branch (904:17): [True: 0, False: 0]
  Branch (904:17): [True: 0, False: 0]
905
0
                case Fragment::ANDOR:
  Branch (905:17): [True: 0, False: 0]
  Branch (905:17): [True: 0, False: 0]
906
                    // and_n(X,Y) is syntactic sugar for andor(X,Y,0).
907
0
                    if (node.subs[2]->fragment == Fragment::JUST_0) return std::move(ret) + "and_n(" + std::move(subs[0]) + "," + std::move(subs[1]) + ")";
  Branch (907:25): [True: 0, False: 0]
  Branch (907:25): [True: 0, False: 0]
908
0
                    return std::move(ret) + "andor(" + std::move(subs[0]) + "," + std::move(subs[1]) + "," + std::move(subs[2]) + ")";
909
0
                case Fragment::MULTI: {
  Branch (909:17): [True: 0, False: 0]
  Branch (909:17): [True: 0, False: 0]
910
0
                    CHECK_NONFATAL(!is_tapscript);
911
0
                    auto str = std::move(ret) + "multi(" + util::ToString(node.k);
912
0
                    for (const auto& key : node.keys) {
  Branch (912:42): [True: 0, False: 0]
  Branch (912:42): [True: 0, False: 0]
913
0
                        auto key_str = ctx.ToString(key);
914
0
                        if (!key_str) return {};
  Branch (914:29): [True: 0, False: 0]
  Branch (914:29): [True: 0, False: 0]
915
0
                        str += "," + std::move(*key_str);
916
0
                    }
917
0
                    return std::move(str) + ")";
918
0
                }
919
0
                case Fragment::MULTI_A: {
  Branch (919:17): [True: 0, False: 0]
  Branch (919:17): [True: 0, False: 0]
920
0
                    CHECK_NONFATAL(is_tapscript);
921
0
                    auto str = std::move(ret) + "multi_a(" + util::ToString(node.k);
922
0
                    for (const auto& key : node.keys) {
  Branch (922:42): [True: 0, False: 0]
  Branch (922:42): [True: 0, False: 0]
923
0
                        auto key_str = ctx.ToString(key);
924
0
                        if (!key_str) return {};
  Branch (924:29): [True: 0, False: 0]
  Branch (924:29): [True: 0, False: 0]
925
0
                        str += "," + std::move(*key_str);
926
0
                    }
927
0
                    return std::move(str) + ")";
928
0
                }
929
0
                case Fragment::THRESH: {
  Branch (929:17): [True: 0, False: 0]
  Branch (929:17): [True: 0, False: 0]
930
0
                    auto str = std::move(ret) + "thresh(" + util::ToString(node.k);
931
0
                    for (auto& sub : subs) {
  Branch (931:36): [True: 0, False: 0]
  Branch (931:36): [True: 0, False: 0]
932
0
                        str += "," + std::move(sub);
933
0
                    }
934
0
                    return std::move(str) + ")";
935
0
                }
936
0
                default: break;
  Branch (936:17): [True: 0, False: 0]
  Branch (936:17): [True: 0, False: 0]
937
0
            }
938
0
            assert(false);
  Branch (938:13): [Folded - Ignored]
  Branch (938:13): [Folded - Ignored]
939
0
        };
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>)#1}::operator()[abi:cxx11](bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>) const
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const::{lambda(bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>)#1}::operator()[abi:cxx11](bool, miniscript::Node<unsigned int> const&, std::span<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 18446744073709551615ul>) const
940
941
0
        return TreeEvalMaybe<std::string>(false, downfn, upfn);
942
0
    }
Unexecuted instantiation: descriptor.cpp:std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > miniscript::Node<unsigned int>::ToString<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const
Unexecuted instantiation: descriptor.cpp:std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > miniscript::Node<unsigned int>::ToString<(anonymous namespace)::StringMaker>((anonymous namespace)::StringMaker const&) const
943
944
private:
945
0
    internal::Ops CalcOps() const {
946
0
        switch (fragment) {
  Branch (946:17): [True: 0, False: 0]
  Branch (946:17): [True: 0, False: 0]
  Branch (946:17): [True: 0, False: 0]
947
0
            case Fragment::JUST_1: return {0, 0, {}};
  Branch (947:13): [True: 0, False: 0]
  Branch (947:13): [True: 0, False: 0]
  Branch (947:13): [True: 0, False: 0]
948
0
            case Fragment::JUST_0: return {0, {}, 0};
  Branch (948:13): [True: 0, False: 0]
  Branch (948:13): [True: 0, False: 0]
  Branch (948:13): [True: 0, False: 0]
949
0
            case Fragment::PK_K: return {0, 0, 0};
  Branch (949:13): [True: 0, False: 0]
  Branch (949:13): [True: 0, False: 0]
  Branch (949:13): [True: 0, False: 0]
950
0
            case Fragment::PK_H: return {3, 0, 0};
  Branch (950:13): [True: 0, False: 0]
  Branch (950:13): [True: 0, False: 0]
  Branch (950:13): [True: 0, False: 0]
951
0
            case Fragment::OLDER:
  Branch (951:13): [True: 0, False: 0]
  Branch (951:13): [True: 0, False: 0]
  Branch (951:13): [True: 0, False: 0]
952
0
            case Fragment::AFTER: return {1, 0, {}};
  Branch (952:13): [True: 0, False: 0]
  Branch (952:13): [True: 0, False: 0]
  Branch (952:13): [True: 0, False: 0]
953
0
            case Fragment::SHA256:
  Branch (953:13): [True: 0, False: 0]
  Branch (953:13): [True: 0, False: 0]
  Branch (953:13): [True: 0, False: 0]
954
0
            case Fragment::RIPEMD160:
  Branch (954:13): [True: 0, False: 0]
  Branch (954:13): [True: 0, False: 0]
  Branch (954:13): [True: 0, False: 0]
955
0
            case Fragment::HASH256:
  Branch (955:13): [True: 0, False: 0]
  Branch (955:13): [True: 0, False: 0]
  Branch (955:13): [True: 0, False: 0]
956
0
            case Fragment::HASH160: return {4, 0, {}};
  Branch (956:13): [True: 0, False: 0]
  Branch (956:13): [True: 0, False: 0]
  Branch (956:13): [True: 0, False: 0]
957
0
            case Fragment::AND_V: return {subs[0]->ops.count + subs[1]->ops.count, subs[0]->ops.sat + subs[1]->ops.sat, {}};
  Branch (957:13): [True: 0, False: 0]
  Branch (957:13): [True: 0, False: 0]
  Branch (957:13): [True: 0, False: 0]
958
0
            case Fragment::AND_B: {
  Branch (958:13): [True: 0, False: 0]
  Branch (958:13): [True: 0, False: 0]
  Branch (958:13): [True: 0, False: 0]
959
0
                const auto count{1 + subs[0]->ops.count + subs[1]->ops.count};
960
0
                const auto sat{subs[0]->ops.sat + subs[1]->ops.sat};
961
0
                const auto dsat{subs[0]->ops.dsat + subs[1]->ops.dsat};
962
0
                return {count, sat, dsat};
963
0
            }
964
0
            case Fragment::OR_B: {
  Branch (964:13): [True: 0, False: 0]
  Branch (964:13): [True: 0, False: 0]
  Branch (964:13): [True: 0, False: 0]
965
0
                const auto count{1 + subs[0]->ops.count + subs[1]->ops.count};
966
0
                const auto sat{(subs[0]->ops.sat + subs[1]->ops.dsat) | (subs[1]->ops.sat + subs[0]->ops.dsat)};
967
0
                const auto dsat{subs[0]->ops.dsat + subs[1]->ops.dsat};
968
0
                return {count, sat, dsat};
969
0
            }
970
0
            case Fragment::OR_D: {
  Branch (970:13): [True: 0, False: 0]
  Branch (970:13): [True: 0, False: 0]
  Branch (970:13): [True: 0, False: 0]
971
0
                const auto count{3 + subs[0]->ops.count + subs[1]->ops.count};
972
0
                const auto sat{subs[0]->ops.sat | (subs[1]->ops.sat + subs[0]->ops.dsat)};
973
0
                const auto dsat{subs[0]->ops.dsat + subs[1]->ops.dsat};
974
0
                return {count, sat, dsat};
975
0
            }
976
0
            case Fragment::OR_C: {
  Branch (976:13): [True: 0, False: 0]
  Branch (976:13): [True: 0, False: 0]
  Branch (976:13): [True: 0, False: 0]
977
0
                const auto count{2 + subs[0]->ops.count + subs[1]->ops.count};
978
0
                const auto sat{subs[0]->ops.sat | (subs[1]->ops.sat + subs[0]->ops.dsat)};
979
0
                return {count, sat, {}};
980
0
            }
981
0
            case Fragment::OR_I: {
  Branch (981:13): [True: 0, False: 0]
  Branch (981:13): [True: 0, False: 0]
  Branch (981:13): [True: 0, False: 0]
982
0
                const auto count{3 + subs[0]->ops.count + subs[1]->ops.count};
983
0
                const auto sat{subs[0]->ops.sat | subs[1]->ops.sat};
984
0
                const auto dsat{subs[0]->ops.dsat | subs[1]->ops.dsat};
985
0
                return {count, sat, dsat};
986
0
            }
987
0
            case Fragment::ANDOR: {
  Branch (987:13): [True: 0, False: 0]
  Branch (987:13): [True: 0, False: 0]
  Branch (987:13): [True: 0, False: 0]
988
0
                const auto count{3 + subs[0]->ops.count + subs[1]->ops.count + subs[2]->ops.count};
989
0
                const auto sat{(subs[1]->ops.sat + subs[0]->ops.sat) | (subs[0]->ops.dsat + subs[2]->ops.sat)};
990
0
                const auto dsat{subs[0]->ops.dsat + subs[2]->ops.dsat};
991
0
                return {count, sat, dsat};
992
0
            }
993
0
            case Fragment::MULTI: return {1, (uint32_t)keys.size(), (uint32_t)keys.size()};
  Branch (993:13): [True: 0, False: 0]
  Branch (993:13): [True: 0, False: 0]
  Branch (993:13): [True: 0, False: 0]
994
0
            case Fragment::MULTI_A: return {(uint32_t)keys.size() + 1, 0, 0};
  Branch (994:13): [True: 0, False: 0]
  Branch (994:13): [True: 0, False: 0]
  Branch (994:13): [True: 0, False: 0]
995
0
            case Fragment::WRAP_S:
  Branch (995:13): [True: 0, False: 0]
  Branch (995:13): [True: 0, False: 0]
  Branch (995:13): [True: 0, False: 0]
996
0
            case Fragment::WRAP_C:
  Branch (996:13): [True: 0, False: 0]
  Branch (996:13): [True: 0, False: 0]
  Branch (996:13): [True: 0, False: 0]
997
0
            case Fragment::WRAP_N: return {1 + subs[0]->ops.count, subs[0]->ops.sat, subs[0]->ops.dsat};
  Branch (997:13): [True: 0, False: 0]
  Branch (997:13): [True: 0, False: 0]
  Branch (997:13): [True: 0, False: 0]
998
0
            case Fragment::WRAP_A: return {2 + subs[0]->ops.count, subs[0]->ops.sat, subs[0]->ops.dsat};
  Branch (998:13): [True: 0, False: 0]
  Branch (998:13): [True: 0, False: 0]
  Branch (998:13): [True: 0, False: 0]
999
0
            case Fragment::WRAP_D: return {3 + subs[0]->ops.count, subs[0]->ops.sat, 0};
  Branch (999:13): [True: 0, False: 0]
  Branch (999:13): [True: 0, False: 0]
  Branch (999:13): [True: 0, False: 0]
1000
0
            case Fragment::WRAP_J: return {4 + subs[0]->ops.count, subs[0]->ops.sat, 0};
  Branch (1000:13): [True: 0, False: 0]
  Branch (1000:13): [True: 0, False: 0]
  Branch (1000:13): [True: 0, False: 0]
1001
0
            case Fragment::WRAP_V: return {subs[0]->ops.count + (subs[0]->GetType() << "x"_mst), subs[0]->ops.sat, {}};
  Branch (1001:13): [True: 0, False: 0]
  Branch (1001:13): [True: 0, False: 0]
  Branch (1001:13): [True: 0, False: 0]
1002
0
            case Fragment::THRESH: {
  Branch (1002:13): [True: 0, False: 0]
  Branch (1002:13): [True: 0, False: 0]
  Branch (1002:13): [True: 0, False: 0]
1003
0
                uint32_t count = 0;
1004
0
                auto sats = Vector(internal::MaxInt<uint32_t>(0));
1005
0
                for (const auto& sub : subs) {
  Branch (1005:38): [True: 0, False: 0]
  Branch (1005:38): [True: 0, False: 0]
  Branch (1005:38): [True: 0, False: 0]
1006
0
                    count += sub->ops.count + 1;
1007
0
                    auto next_sats = Vector(sats[0] + sub->ops.dsat);
1008
0
                    for (size_t j = 1; j < sats.size(); ++j) next_sats.push_back((sats[j] + sub->ops.dsat) | (sats[j - 1] + sub->ops.sat));
  Branch (1008:40): [True: 0, False: 0]
  Branch (1008:40): [True: 0, False: 0]
  Branch (1008:40): [True: 0, False: 0]
1009
0
                    next_sats.push_back(sats[sats.size() - 1] + sub->ops.sat);
1010
0
                    sats = std::move(next_sats);
1011
0
                }
1012
0
                assert(k < sats.size());
  Branch (1012:17): [True: 0, False: 0]
  Branch (1012:17): [True: 0, False: 0]
  Branch (1012:17): [True: 0, False: 0]
1013
0
                return {count, sats[k], sats[0]};
1014
0
            }
1015
0
        }
1016
0
        assert(false);
  Branch (1016:9): [Folded - Ignored]
  Branch (1016:9): [Folded - Ignored]
  Branch (1016:9): [Folded - Ignored]
1017
0
    }
Unexecuted instantiation: miniscript::Node<unsigned int>::CalcOps() const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::CalcOps() const
Unexecuted instantiation: miniscript::Node<CPubKey>::CalcOps() const
1018
1019
0
    internal::StackSize CalcStackSize() const {
1020
0
        using namespace internal;
1021
0
        switch (fragment) {
  Branch (1021:17): [True: 0, False: 0]
  Branch (1021:17): [True: 0, False: 0]
  Branch (1021:17): [True: 0, False: 0]
1022
0
            case Fragment::JUST_0: return {{}, SatInfo::Push()};
  Branch (1022:13): [True: 0, False: 0]
  Branch (1022:13): [True: 0, False: 0]
  Branch (1022:13): [True: 0, False: 0]
1023
0
            case Fragment::JUST_1: return {SatInfo::Push(), {}};
  Branch (1023:13): [True: 0, False: 0]
  Branch (1023:13): [True: 0, False: 0]
  Branch (1023:13): [True: 0, False: 0]
1024
0
            case Fragment::OLDER:
  Branch (1024:13): [True: 0, False: 0]
  Branch (1024:13): [True: 0, False: 0]
  Branch (1024:13): [True: 0, False: 0]
1025
0
            case Fragment::AFTER: return {SatInfo::Push() + SatInfo::Nop(), {}};
  Branch (1025:13): [True: 0, False: 0]
  Branch (1025:13): [True: 0, False: 0]
  Branch (1025:13): [True: 0, False: 0]
1026
0
            case Fragment::PK_K: return {SatInfo::Push()};
  Branch (1026:13): [True: 0, False: 0]
  Branch (1026:13): [True: 0, False: 0]
  Branch (1026:13): [True: 0, False: 0]
1027
0
            case Fragment::PK_H: return {SatInfo::OP_DUP() + SatInfo::Hash() + SatInfo::Push() + SatInfo::OP_EQUALVERIFY()};
  Branch (1027:13): [True: 0, False: 0]
  Branch (1027:13): [True: 0, False: 0]
  Branch (1027:13): [True: 0, False: 0]
1028
0
            case Fragment::SHA256:
  Branch (1028:13): [True: 0, False: 0]
  Branch (1028:13): [True: 0, False: 0]
  Branch (1028:13): [True: 0, False: 0]
1029
0
            case Fragment::RIPEMD160:
  Branch (1029:13): [True: 0, False: 0]
  Branch (1029:13): [True: 0, False: 0]
  Branch (1029:13): [True: 0, False: 0]
1030
0
            case Fragment::HASH256:
  Branch (1030:13): [True: 0, False: 0]
  Branch (1030:13): [True: 0, False: 0]
  Branch (1030:13): [True: 0, False: 0]
1031
0
            case Fragment::HASH160: return {
  Branch (1031:13): [True: 0, False: 0]
  Branch (1031:13): [True: 0, False: 0]
  Branch (1031:13): [True: 0, False: 0]
1032
0
                SatInfo::OP_SIZE() + SatInfo::Push() + SatInfo::OP_EQUALVERIFY() + SatInfo::Hash() + SatInfo::Push() + SatInfo::OP_EQUAL(),
1033
0
                {}
1034
0
            };
1035
0
            case Fragment::ANDOR: {
  Branch (1035:13): [True: 0, False: 0]
  Branch (1035:13): [True: 0, False: 0]
  Branch (1035:13): [True: 0, False: 0]
1036
0
                const auto& x{subs[0]->ss};
1037
0
                const auto& y{subs[1]->ss};
1038
0
                const auto& z{subs[2]->ss};
1039
0
                return {
1040
0
                    (x.sat + SatInfo::If() + y.sat) | (x.dsat + SatInfo::If() + z.sat),
1041
0
                    x.dsat + SatInfo::If() + z.dsat
1042
0
                };
1043
0
            }
1044
0
            case Fragment::AND_V: {
  Branch (1044:13): [True: 0, False: 0]
  Branch (1044:13): [True: 0, False: 0]
  Branch (1044:13): [True: 0, False: 0]
1045
0
                const auto& x{subs[0]->ss};
1046
0
                const auto& y{subs[1]->ss};
1047
0
                return {x.sat + y.sat, {}};
1048
0
            }
1049
0
            case Fragment::AND_B: {
  Branch (1049:13): [True: 0, False: 0]
  Branch (1049:13): [True: 0, False: 0]
  Branch (1049:13): [True: 0, False: 0]
1050
0
                const auto& x{subs[0]->ss};
1051
0
                const auto& y{subs[1]->ss};
1052
0
                return {x.sat + y.sat + SatInfo::BinaryOp(), x.dsat + y.dsat + SatInfo::BinaryOp()};
1053
0
            }
1054
0
            case Fragment::OR_B: {
  Branch (1054:13): [True: 0, False: 0]
  Branch (1054:13): [True: 0, False: 0]
  Branch (1054:13): [True: 0, False: 0]
1055
0
                const auto& x{subs[0]->ss};
1056
0
                const auto& y{subs[1]->ss};
1057
0
                return {
1058
0
                    ((x.sat + y.dsat) | (x.dsat + y.sat)) + SatInfo::BinaryOp(),
1059
0
                    x.dsat + y.dsat + SatInfo::BinaryOp()
1060
0
                };
1061
0
            }
1062
0
            case Fragment::OR_C: {
  Branch (1062:13): [True: 0, False: 0]
  Branch (1062:13): [True: 0, False: 0]
  Branch (1062:13): [True: 0, False: 0]
1063
0
                const auto& x{subs[0]->ss};
1064
0
                const auto& y{subs[1]->ss};
1065
0
                return {(x.sat + SatInfo::If()) | (x.dsat + SatInfo::If() + y.sat), {}};
1066
0
            }
1067
0
            case Fragment::OR_D: {
  Branch (1067:13): [True: 0, False: 0]
  Branch (1067:13): [True: 0, False: 0]
  Branch (1067:13): [True: 0, False: 0]
1068
0
                const auto& x{subs[0]->ss};
1069
0
                const auto& y{subs[1]->ss};
1070
0
                return {
1071
0
                    (x.sat + SatInfo::OP_IFDUP(true) + SatInfo::If()) | (x.dsat + SatInfo::OP_IFDUP(false) + SatInfo::If() + y.sat),
1072
0
                    x.dsat + SatInfo::OP_IFDUP(false) + SatInfo::If() + y.dsat
1073
0
                };
1074
0
            }
1075
0
            case Fragment::OR_I: {
  Branch (1075:13): [True: 0, False: 0]
  Branch (1075:13): [True: 0, False: 0]
  Branch (1075:13): [True: 0, False: 0]
1076
0
                const auto& x{subs[0]->ss};
1077
0
                const auto& y{subs[1]->ss};
1078
0
                return {SatInfo::If() + (x.sat | y.sat), SatInfo::If() + (x.dsat | y.dsat)};
1079
0
            }
1080
            // multi(k, key1, key2, ..., key_n) starts off with k+1 stack elements (a 0, plus k
1081
            // signatures), then reaches n+k+3 stack elements after pushing the n keys, plus k and
1082
            // n itself, and ends with 1 stack element (success or failure). Thus, it net removes
1083
            // k elements (from k+1 to 1), while reaching k+n+2 more than it ends with.
1084
0
            case Fragment::MULTI: return {SatInfo(k, k + keys.size() + 2)};
  Branch (1084:13): [True: 0, False: 0]
  Branch (1084:13): [True: 0, False: 0]
  Branch (1084:13): [True: 0, False: 0]
1085
            // multi_a(k, key1, key2, ..., key_n) starts off with n stack elements (the
1086
            // signatures), reaches 1 more (after the first key push), and ends with 1. Thus it net
1087
            // removes n-1 elements (from n to 1) while reaching n more than it ends with.
1088
0
            case Fragment::MULTI_A: return {SatInfo(keys.size() - 1, keys.size())};
  Branch (1088:13): [True: 0, False: 0]
  Branch (1088:13): [True: 0, False: 0]
  Branch (1088:13): [True: 0, False: 0]
1089
0
            case Fragment::WRAP_A:
  Branch (1089:13): [True: 0, False: 0]
  Branch (1089:13): [True: 0, False: 0]
  Branch (1089:13): [True: 0, False: 0]
1090
0
            case Fragment::WRAP_N:
  Branch (1090:13): [True: 0, False: 0]
  Branch (1090:13): [True: 0, False: 0]
  Branch (1090:13): [True: 0, False: 0]
1091
0
            case Fragment::WRAP_S: return subs[0]->ss;
  Branch (1091:13): [True: 0, False: 0]
  Branch (1091:13): [True: 0, False: 0]
  Branch (1091:13): [True: 0, False: 0]
1092
0
            case Fragment::WRAP_C: return {
  Branch (1092:13): [True: 0, False: 0]
  Branch (1092:13): [True: 0, False: 0]
  Branch (1092:13): [True: 0, False: 0]
1093
0
                subs[0]->ss.sat + SatInfo::OP_CHECKSIG(),
1094
0
                subs[0]->ss.dsat + SatInfo::OP_CHECKSIG()
1095
0
            };
1096
0
            case Fragment::WRAP_D: return {
  Branch (1096:13): [True: 0, False: 0]
  Branch (1096:13): [True: 0, False: 0]
  Branch (1096:13): [True: 0, False: 0]
1097
0
                SatInfo::OP_DUP() + SatInfo::If() + subs[0]->ss.sat,
1098
0
                SatInfo::OP_DUP() + SatInfo::If()
1099
0
            };
1100
0
            case Fragment::WRAP_V: return {subs[0]->ss.sat + SatInfo::OP_VERIFY(), {}};
  Branch (1100:13): [True: 0, False: 0]
  Branch (1100:13): [True: 0, False: 0]
  Branch (1100:13): [True: 0, False: 0]
1101
0
            case Fragment::WRAP_J: return {
  Branch (1101:13): [True: 0, False: 0]
  Branch (1101:13): [True: 0, False: 0]
  Branch (1101:13): [True: 0, False: 0]
1102
0
                SatInfo::OP_SIZE() + SatInfo::OP_0NOTEQUAL() + SatInfo::If() + subs[0]->ss.sat,
1103
0
                SatInfo::OP_SIZE() + SatInfo::OP_0NOTEQUAL() + SatInfo::If()
1104
0
            };
1105
0
            case Fragment::THRESH: {
  Branch (1105:13): [True: 0, False: 0]
  Branch (1105:13): [True: 0, False: 0]
  Branch (1105:13): [True: 0, False: 0]
1106
                // sats[j] is the SatInfo corresponding to all traces reaching j satisfactions.
1107
0
                auto sats = Vector(SatInfo::Empty());
1108
0
                for (size_t i = 0; i < subs.size(); ++i) {
  Branch (1108:36): [True: 0, False: 0]
  Branch (1108:36): [True: 0, False: 0]
  Branch (1108:36): [True: 0, False: 0]
1109
                    // Loop over the subexpressions, processing them one by one. After adding
1110
                    // element i we need to add OP_ADD (if i>0).
1111
0
                    auto add = i ? SatInfo::BinaryOp() : SatInfo::Empty();
  Branch (1111:32): [True: 0, False: 0]
  Branch (1111:32): [True: 0, False: 0]
  Branch (1111:32): [True: 0, False: 0]
1112
                    // Construct a variable that will become the next sats, starting with index 0.
1113
0
                    auto next_sats = Vector(sats[0] + subs[i]->ss.dsat + add);
1114
                    // Then loop to construct next_sats[1..i].
1115
0
                    for (size_t j = 1; j < sats.size(); ++j) {
  Branch (1115:40): [True: 0, False: 0]
  Branch (1115:40): [True: 0, False: 0]
  Branch (1115:40): [True: 0, False: 0]
1116
0
                        next_sats.push_back(((sats[j] + subs[i]->ss.dsat) | (sats[j - 1] + subs[i]->ss.sat)) + add);
1117
0
                    }
1118
                    // Finally construct next_sats[i+1].
1119
0
                    next_sats.push_back(sats[sats.size() - 1] + subs[i]->ss.sat + add);
1120
                    // Switch over.
1121
0
                    sats = std::move(next_sats);
1122
0
                }
1123
                // To satisfy thresh we need k satisfactions; to dissatisfy we need 0. In both
1124
                // cases a push of k and an OP_EQUAL follow.
1125
0
                return {
1126
0
                    sats[k] + SatInfo::Push() + SatInfo::OP_EQUAL(),
1127
0
                    sats[0] + SatInfo::Push() + SatInfo::OP_EQUAL()
1128
0
                };
1129
0
            }
1130
0
        }
1131
0
        assert(false);
  Branch (1131:9): [Folded - Ignored]
  Branch (1131:9): [Folded - Ignored]
  Branch (1131:9): [Folded - Ignored]
1132
0
    }
Unexecuted instantiation: miniscript::Node<unsigned int>::CalcStackSize() const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::CalcStackSize() const
Unexecuted instantiation: miniscript::Node<CPubKey>::CalcStackSize() const
1133
1134
0
    internal::WitnessSize CalcWitnessSize() const {
1135
0
        const uint32_t sig_size = IsTapscript(m_script_ctx) ? 1 + 65 : 1 + 72;
  Branch (1135:35): [True: 0, False: 0]
  Branch (1135:35): [True: 0, False: 0]
  Branch (1135:35): [True: 0, False: 0]
1136
0
        const uint32_t pubkey_size = IsTapscript(m_script_ctx) ? 1 + 32 : 1 + 33;
  Branch (1136:38): [True: 0, False: 0]
  Branch (1136:38): [True: 0, False: 0]
  Branch (1136:38): [True: 0, False: 0]
1137
0
        switch (fragment) {
  Branch (1137:17): [True: 0, False: 0]
  Branch (1137:17): [True: 0, False: 0]
  Branch (1137:17): [True: 0, False: 0]
1138
0
            case Fragment::JUST_0: return {{}, 0};
  Branch (1138:13): [True: 0, False: 0]
  Branch (1138:13): [True: 0, False: 0]
  Branch (1138:13): [True: 0, False: 0]
1139
0
            case Fragment::JUST_1:
  Branch (1139:13): [True: 0, False: 0]
  Branch (1139:13): [True: 0, False: 0]
  Branch (1139:13): [True: 0, False: 0]
1140
0
            case Fragment::OLDER:
  Branch (1140:13): [True: 0, False: 0]
  Branch (1140:13): [True: 0, False: 0]
  Branch (1140:13): [True: 0, False: 0]
1141
0
            case Fragment::AFTER: return {0, {}};
  Branch (1141:13): [True: 0, False: 0]
  Branch (1141:13): [True: 0, False: 0]
  Branch (1141:13): [True: 0, False: 0]
1142
0
            case Fragment::PK_K: return {sig_size, 1};
  Branch (1142:13): [True: 0, False: 0]
  Branch (1142:13): [True: 0, False: 0]
  Branch (1142:13): [True: 0, False: 0]
1143
0
            case Fragment::PK_H: return {sig_size + pubkey_size, 1 + pubkey_size};
  Branch (1143:13): [True: 0, False: 0]
  Branch (1143:13): [True: 0, False: 0]
  Branch (1143:13): [True: 0, False: 0]
1144
0
            case Fragment::SHA256:
  Branch (1144:13): [True: 0, False: 0]
  Branch (1144:13): [True: 0, False: 0]
  Branch (1144:13): [True: 0, False: 0]
1145
0
            case Fragment::RIPEMD160:
  Branch (1145:13): [True: 0, False: 0]
  Branch (1145:13): [True: 0, False: 0]
  Branch (1145:13): [True: 0, False: 0]
1146
0
            case Fragment::HASH256:
  Branch (1146:13): [True: 0, False: 0]
  Branch (1146:13): [True: 0, False: 0]
  Branch (1146:13): [True: 0, False: 0]
1147
0
            case Fragment::HASH160: return {1 + 32, {}};
  Branch (1147:13): [True: 0, False: 0]
  Branch (1147:13): [True: 0, False: 0]
  Branch (1147:13): [True: 0, False: 0]
1148
0
            case Fragment::ANDOR: {
  Branch (1148:13): [True: 0, False: 0]
  Branch (1148:13): [True: 0, False: 0]
  Branch (1148:13): [True: 0, False: 0]
1149
0
                const auto sat{(subs[0]->ws.sat + subs[1]->ws.sat) | (subs[0]->ws.dsat + subs[2]->ws.sat)};
1150
0
                const auto dsat{subs[0]->ws.dsat + subs[2]->ws.dsat};
1151
0
                return {sat, dsat};
1152
0
            }
1153
0
            case Fragment::AND_V: return {subs[0]->ws.sat + subs[1]->ws.sat, {}};
  Branch (1153:13): [True: 0, False: 0]
  Branch (1153:13): [True: 0, False: 0]
  Branch (1153:13): [True: 0, False: 0]
1154
0
            case Fragment::AND_B: return {subs[0]->ws.sat + subs[1]->ws.sat, subs[0]->ws.dsat + subs[1]->ws.dsat};
  Branch (1154:13): [True: 0, False: 0]
  Branch (1154:13): [True: 0, False: 0]
  Branch (1154:13): [True: 0, False: 0]
1155
0
            case Fragment::OR_B: {
  Branch (1155:13): [True: 0, False: 0]
  Branch (1155:13): [True: 0, False: 0]
  Branch (1155:13): [True: 0, False: 0]
1156
0
                const auto sat{(subs[0]->ws.dsat + subs[1]->ws.sat) | (subs[0]->ws.sat + subs[1]->ws.dsat)};
1157
0
                const auto dsat{subs[0]->ws.dsat + subs[1]->ws.dsat};
1158
0
                return {sat, dsat};
1159
0
            }
1160
0
            case Fragment::OR_C: return {subs[0]->ws.sat | (subs[0]->ws.dsat + subs[1]->ws.sat), {}};
  Branch (1160:13): [True: 0, False: 0]
  Branch (1160:13): [True: 0, False: 0]
  Branch (1160:13): [True: 0, False: 0]
1161
0
            case Fragment::OR_D: return {subs[0]->ws.sat | (subs[0]->ws.dsat + subs[1]->ws.sat), subs[0]->ws.dsat + subs[1]->ws.dsat};
  Branch (1161:13): [True: 0, False: 0]
  Branch (1161:13): [True: 0, False: 0]
  Branch (1161:13): [True: 0, False: 0]
1162
0
            case Fragment::OR_I: return {(subs[0]->ws.sat + 1 + 1) | (subs[1]->ws.sat + 1), (subs[0]->ws.dsat + 1 + 1) | (subs[1]->ws.dsat + 1)};
  Branch (1162:13): [True: 0, False: 0]
  Branch (1162:13): [True: 0, False: 0]
  Branch (1162:13): [True: 0, False: 0]
1163
0
            case Fragment::MULTI: return {k * sig_size + 1, k + 1};
  Branch (1163:13): [True: 0, False: 0]
  Branch (1163:13): [True: 0, False: 0]
  Branch (1163:13): [True: 0, False: 0]
1164
0
            case Fragment::MULTI_A: return {k * sig_size + static_cast<uint32_t>(keys.size()) - k, static_cast<uint32_t>(keys.size())};
  Branch (1164:13): [True: 0, False: 0]
  Branch (1164:13): [True: 0, False: 0]
  Branch (1164:13): [True: 0, False: 0]
1165
0
            case Fragment::WRAP_A:
  Branch (1165:13): [True: 0, False: 0]
  Branch (1165:13): [True: 0, False: 0]
  Branch (1165:13): [True: 0, False: 0]
1166
0
            case Fragment::WRAP_N:
  Branch (1166:13): [True: 0, False: 0]
  Branch (1166:13): [True: 0, False: 0]
  Branch (1166:13): [True: 0, False: 0]
1167
0
            case Fragment::WRAP_S:
  Branch (1167:13): [True: 0, False: 0]
  Branch (1167:13): [True: 0, False: 0]
  Branch (1167:13): [True: 0, False: 0]
1168
0
            case Fragment::WRAP_C: return subs[0]->ws;
  Branch (1168:13): [True: 0, False: 0]
  Branch (1168:13): [True: 0, False: 0]
  Branch (1168:13): [True: 0, False: 0]
1169
0
            case Fragment::WRAP_D: return {1 + 1 + subs[0]->ws.sat, 1};
  Branch (1169:13): [True: 0, False: 0]
  Branch (1169:13): [True: 0, False: 0]
  Branch (1169:13): [True: 0, False: 0]
1170
0
            case Fragment::WRAP_V: return {subs[0]->ws.sat, {}};
  Branch (1170:13): [True: 0, False: 0]
  Branch (1170:13): [True: 0, False: 0]
  Branch (1170:13): [True: 0, False: 0]
1171
0
            case Fragment::WRAP_J: return {subs[0]->ws.sat, 1};
  Branch (1171:13): [True: 0, False: 0]
  Branch (1171:13): [True: 0, False: 0]
  Branch (1171:13): [True: 0, False: 0]
1172
0
            case Fragment::THRESH: {
  Branch (1172:13): [True: 0, False: 0]
  Branch (1172:13): [True: 0, False: 0]
  Branch (1172:13): [True: 0, False: 0]
1173
0
                auto sats = Vector(internal::MaxInt<uint32_t>(0));
1174
0
                for (const auto& sub : subs) {
  Branch (1174:38): [True: 0, False: 0]
  Branch (1174:38): [True: 0, False: 0]
  Branch (1174:38): [True: 0, False: 0]
1175
0
                    auto next_sats = Vector(sats[0] + sub->ws.dsat);
1176
0
                    for (size_t j = 1; j < sats.size(); ++j) next_sats.push_back((sats[j] + sub->ws.dsat) | (sats[j - 1] + sub->ws.sat));
  Branch (1176:40): [True: 0, False: 0]
  Branch (1176:40): [True: 0, False: 0]
  Branch (1176:40): [True: 0, False: 0]
1177
0
                    next_sats.push_back(sats[sats.size() - 1] + sub->ws.sat);
1178
0
                    sats = std::move(next_sats);
1179
0
                }
1180
0
                assert(k < sats.size());
  Branch (1180:17): [True: 0, False: 0]
  Branch (1180:17): [True: 0, False: 0]
  Branch (1180:17): [True: 0, False: 0]
1181
0
                return {sats[k], sats[0]};
1182
0
            }
1183
0
        }
1184
0
        assert(false);
  Branch (1184:9): [Folded - Ignored]
  Branch (1184:9): [Folded - Ignored]
  Branch (1184:9): [Folded - Ignored]
1185
0
    }
Unexecuted instantiation: miniscript::Node<unsigned int>::CalcWitnessSize() const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::CalcWitnessSize() const
Unexecuted instantiation: miniscript::Node<CPubKey>::CalcWitnessSize() const
1186
1187
    template<typename Ctx>
1188
0
    internal::InputResult ProduceInput(const Ctx& ctx) const {
1189
0
        using namespace internal;
1190
1191
        // Internal function which is invoked for every tree node, constructing satisfaction/dissatisfactions
1192
        // given those of its subnodes.
1193
0
        auto helper = [&ctx](const Node& node, std::span<InputResult> subres) -> InputResult {
1194
0
            switch (node.fragment) {
  Branch (1194:21): [True: 0, False: 0]
  Branch (1194:21): [True: 0, False: 0]
1195
0
                case Fragment::PK_K: {
  Branch (1195:17): [True: 0, False: 0]
  Branch (1195:17): [True: 0, False: 0]
1196
0
                    std::vector<unsigned char> sig;
1197
0
                    Availability avail = ctx.Sign(node.keys[0], sig);
1198
0
                    return {ZERO, InputStack(std::move(sig)).SetWithSig().SetAvailable(avail)};
1199
0
                }
1200
0
                case Fragment::PK_H: {
  Branch (1200:17): [True: 0, False: 0]
  Branch (1200:17): [True: 0, False: 0]
1201
0
                    std::vector<unsigned char> key = ctx.ToPKBytes(node.keys[0]), sig;
1202
0
                    Availability avail = ctx.Sign(node.keys[0], sig);
1203
0
                    return {ZERO + InputStack(key), (InputStack(std::move(sig)).SetWithSig() + InputStack(key)).SetAvailable(avail)};
1204
0
                }
1205
0
                case Fragment::MULTI_A: {
  Branch (1205:17): [True: 0, False: 0]
  Branch (1205:17): [True: 0, False: 0]
1206
                    // sats[j] represents the best stack containing j valid signatures (out of the first i keys).
1207
                    // In the loop below, these stacks are built up using a dynamic programming approach.
1208
0
                    std::vector<InputStack> sats = Vector(EMPTY);
1209
0
                    for (size_t i = 0; i < node.keys.size(); ++i) {
  Branch (1209:40): [True: 0, False: 0]
  Branch (1209:40): [True: 0, False: 0]
1210
                        // Get the signature for the i'th key in reverse order (the signature for the first key needs to
1211
                        // be at the top of the stack, contrary to CHECKMULTISIG's satisfaction).
1212
0
                        std::vector<unsigned char> sig;
1213
0
                        Availability avail = ctx.Sign(node.keys[node.keys.size() - 1 - i], sig);
1214
                        // Compute signature stack for just this key.
1215
0
                        auto sat = InputStack(std::move(sig)).SetWithSig().SetAvailable(avail);
1216
                        // Compute the next sats vector: next_sats[0] is a copy of sats[0] (no signatures). All further
1217
                        // next_sats[j] are equal to either the existing sats[j] + ZERO, or sats[j-1] plus a signature
1218
                        // for the current (i'th) key. The very last element needs all signatures filled.
1219
0
                        std::vector<InputStack> next_sats;
1220
0
                        next_sats.push_back(sats[0] + ZERO);
1221
0
                        for (size_t j = 1; j < sats.size(); ++j) next_sats.push_back((sats[j] + ZERO) | (std::move(sats[j - 1]) + sat));
  Branch (1221:44): [True: 0, False: 0]
  Branch (1221:44): [True: 0, False: 0]
1222
0
                        next_sats.push_back(std::move(sats[sats.size() - 1]) + std::move(sat));
1223
                        // Switch over.
1224
0
                        sats = std::move(next_sats);
1225
0
                    }
1226
                    // The dissatisfaction consists of as many empty vectors as there are keys, which is the same as
1227
                    // satisfying 0 keys.
1228
0
                    auto& nsat{sats[0]};
1229
0
                    CHECK_NONFATAL(node.k != 0);
1230
0
                    assert(node.k < sats.size());
  Branch (1230:21): [True: 0, False: 0]
  Branch (1230:21): [True: 0, False: 0]
1231
0
                    return {std::move(nsat), std::move(sats[node.k])};
1232
0
                }
1233
0
                case Fragment::MULTI: {
  Branch (1233:17): [True: 0, False: 0]
  Branch (1233:17): [True: 0, False: 0]
1234
                    // sats[j] represents the best stack containing j valid signatures (out of the first i keys).
1235
                    // In the loop below, these stacks are built up using a dynamic programming approach.
1236
                    // sats[0] starts off being {0}, due to the CHECKMULTISIG bug that pops off one element too many.
1237
0
                    std::vector<InputStack> sats = Vector(ZERO);
1238
0
                    for (size_t i = 0; i < node.keys.size(); ++i) {
  Branch (1238:40): [True: 0, False: 0]
  Branch (1238:40): [True: 0, False: 0]
1239
0
                        std::vector<unsigned char> sig;
1240
0
                        Availability avail = ctx.Sign(node.keys[i], sig);
1241
                        // Compute signature stack for just the i'th key.
1242
0
                        auto sat = InputStack(std::move(sig)).SetWithSig().SetAvailable(avail);
1243
                        // Compute the next sats vector: next_sats[0] is a copy of sats[0] (no signatures). All further
1244
                        // next_sats[j] are equal to either the existing sats[j], or sats[j-1] plus a signature for the
1245
                        // current (i'th) key. The very last element needs all signatures filled.
1246
0
                        std::vector<InputStack> next_sats;
1247
0
                        next_sats.push_back(sats[0]);
1248
0
                        for (size_t j = 1; j < sats.size(); ++j) next_sats.push_back(sats[j] | (std::move(sats[j - 1]) + sat));
  Branch (1248:44): [True: 0, False: 0]
  Branch (1248:44): [True: 0, False: 0]
1249
0
                        next_sats.push_back(std::move(sats[sats.size() - 1]) + std::move(sat));
1250
                        // Switch over.
1251
0
                        sats = std::move(next_sats);
1252
0
                    }
1253
                    // The dissatisfaction consists of k+1 stack elements all equal to 0.
1254
0
                    InputStack nsat = ZERO;
1255
0
                    for (size_t i = 0; i < node.k; ++i) nsat = std::move(nsat) + ZERO;
  Branch (1255:40): [True: 0, False: 0]
  Branch (1255:40): [True: 0, False: 0]
1256
0
                    assert(node.k < sats.size());
  Branch (1256:21): [True: 0, False: 0]
  Branch (1256:21): [True: 0, False: 0]
1257
0
                    return {std::move(nsat), std::move(sats[node.k])};
1258
0
                }
1259
0
                case Fragment::THRESH: {
  Branch (1259:17): [True: 0, False: 0]
  Branch (1259:17): [True: 0, False: 0]
1260
                    // sats[k] represents the best stack that satisfies k out of the *last* i subexpressions.
1261
                    // In the loop below, these stacks are built up using a dynamic programming approach.
1262
                    // sats[0] starts off empty.
1263
0
                    std::vector<InputStack> sats = Vector(EMPTY);
1264
0
                    for (size_t i = 0; i < subres.size(); ++i) {
  Branch (1264:40): [True: 0, False: 0]
  Branch (1264:40): [True: 0, False: 0]
1265
                        // Introduce an alias for the i'th last satisfaction/dissatisfaction.
1266
0
                        auto& res = subres[subres.size() - i - 1];
1267
                        // Compute the next sats vector: next_sats[0] is sats[0] plus res.nsat (thus containing all dissatisfactions
1268
                        // so far. next_sats[j] is either sats[j] + res.nsat (reusing j earlier satisfactions) or sats[j-1] + res.sat
1269
                        // (reusing j-1 earlier satisfactions plus a new one). The very last next_sats[j] is all satisfactions.
1270
0
                        std::vector<InputStack> next_sats;
1271
0
                        next_sats.push_back(sats[0] + res.nsat);
1272
0
                        for (size_t j = 1; j < sats.size(); ++j) next_sats.push_back((sats[j] + res.nsat) | (std::move(sats[j - 1]) + res.sat));
  Branch (1272:44): [True: 0, False: 0]
  Branch (1272:44): [True: 0, False: 0]
1273
0
                        next_sats.push_back(std::move(sats[sats.size() - 1]) + std::move(res.sat));
1274
                        // Switch over.
1275
0
                        sats = std::move(next_sats);
1276
0
                    }
1277
                    // At this point, sats[k].sat is the best satisfaction for the overall thresh() node. The best dissatisfaction
1278
                    // is computed by gathering all sats[i].nsat for i != k.
1279
0
                    InputStack nsat = INVALID;
1280
0
                    for (size_t i = 0; i < sats.size(); ++i) {
  Branch (1280:40): [True: 0, False: 0]
  Branch (1280:40): [True: 0, False: 0]
1281
                        // i==k is the satisfaction; i==0 is the canonical dissatisfaction;
1282
                        // the rest are non-canonical (a no-signature dissatisfaction - the i=0
1283
                        // form - is always available) and malleable (due to overcompleteness).
1284
                        // Marking the solutions malleable here is not strictly necessary, as they
1285
                        // should already never be picked in non-malleable solutions due to the
1286
                        // availability of the i=0 form.
1287
0
                        if (i != 0 && i != node.k) sats[i].SetMalleable().SetNonCanon();
  Branch (1287:29): [True: 0, False: 0]
  Branch (1287:39): [True: 0, False: 0]
  Branch (1287:29): [True: 0, False: 0]
  Branch (1287:39): [True: 0, False: 0]
1288
                        // Include all dissatisfactions (even these non-canonical ones) in nsat.
1289
0
                        if (i != node.k) nsat = std::move(nsat) | std::move(sats[i]);
  Branch (1289:29): [True: 0, False: 0]
  Branch (1289:29): [True: 0, False: 0]
1290
0
                    }
1291
0
                    assert(node.k < sats.size());
  Branch (1291:21): [True: 0, False: 0]
  Branch (1291:21): [True: 0, False: 0]
1292
0
                    return {std::move(nsat), std::move(sats[node.k])};
1293
0
                }
1294
0
                case Fragment::OLDER: {
  Branch (1294:17): [True: 0, False: 0]
  Branch (1294:17): [True: 0, False: 0]
1295
0
                    return {INVALID, ctx.CheckOlder(node.k) ? EMPTY : INVALID};
  Branch (1295:38): [True: 0, False: 0]
  Branch (1295:38): [True: 0, False: 0]
1296
0
                }
1297
0
                case Fragment::AFTER: {
  Branch (1297:17): [True: 0, False: 0]
  Branch (1297:17): [True: 0, False: 0]
1298
0
                    return {INVALID, ctx.CheckAfter(node.k) ? EMPTY : INVALID};
  Branch (1298:38): [True: 0, False: 0]
  Branch (1298:38): [True: 0, False: 0]
1299
0
                }
1300
0
                case Fragment::SHA256: {
  Branch (1300:17): [True: 0, False: 0]
  Branch (1300:17): [True: 0, False: 0]
1301
0
                    std::vector<unsigned char> preimage;
1302
0
                    Availability avail = ctx.SatSHA256(node.data, preimage);
1303
0
                    return {ZERO32, InputStack(std::move(preimage)).SetAvailable(avail)};
1304
0
                }
1305
0
                case Fragment::RIPEMD160: {
  Branch (1305:17): [True: 0, False: 0]
  Branch (1305:17): [True: 0, False: 0]
1306
0
                    std::vector<unsigned char> preimage;
1307
0
                    Availability avail = ctx.SatRIPEMD160(node.data, preimage);
1308
0
                    return {ZERO32, InputStack(std::move(preimage)).SetAvailable(avail)};
1309
0
                }
1310
0
                case Fragment::HASH256: {
  Branch (1310:17): [True: 0, False: 0]
  Branch (1310:17): [True: 0, False: 0]
1311
0
                    std::vector<unsigned char> preimage;
1312
0
                    Availability avail = ctx.SatHASH256(node.data, preimage);
1313
0
                    return {ZERO32, InputStack(std::move(preimage)).SetAvailable(avail)};
1314
0
                }
1315
0
                case Fragment::HASH160: {
  Branch (1315:17): [True: 0, False: 0]
  Branch (1315:17): [True: 0, False: 0]
1316
0
                    std::vector<unsigned char> preimage;
1317
0
                    Availability avail = ctx.SatHASH160(node.data, preimage);
1318
0
                    return {ZERO32, InputStack(std::move(preimage)).SetAvailable(avail)};
1319
0
                }
1320
0
                case Fragment::AND_V: {
  Branch (1320:17): [True: 0, False: 0]
  Branch (1320:17): [True: 0, False: 0]
1321
0
                    auto& x = subres[0], &y = subres[1];
1322
                    // As the dissatisfaction here only consist of a single option, it doesn't
1323
                    // actually need to be listed (it's not required for reasoning about malleability of
1324
                    // other options), and is never required (no valid miniscript relies on the ability
1325
                    // to satisfy the type V left subexpression). It's still listed here for
1326
                    // completeness, as a hypothetical (not currently implemented) satisfier that doesn't
1327
                    // care about malleability might in some cases prefer it still.
1328
0
                    return {(y.nsat + x.sat).SetNonCanon(), y.sat + x.sat};
1329
0
                }
1330
0
                case Fragment::AND_B: {
  Branch (1330:17): [True: 0, False: 0]
  Branch (1330:17): [True: 0, False: 0]
1331
0
                    auto& x = subres[0], &y = subres[1];
1332
                    // Note that it is not strictly necessary to mark the 2nd and 3rd dissatisfaction here
1333
                    // as malleable. While they are definitely malleable, they are also non-canonical due
1334
                    // to the guaranteed existence of a no-signature other dissatisfaction (the 1st)
1335
                    // option. Because of that, the 2nd and 3rd option will never be chosen, even if they
1336
                    // weren't marked as malleable.
1337
0
                    return {(y.nsat + x.nsat) | (y.sat + x.nsat).SetMalleable().SetNonCanon() | (y.nsat + x.sat).SetMalleable().SetNonCanon(), y.sat + x.sat};
1338
0
                }
1339
0
                case Fragment::OR_B: {
  Branch (1339:17): [True: 0, False: 0]
  Branch (1339:17): [True: 0, False: 0]
1340
0
                    auto& x = subres[0], &z = subres[1];
1341
                    // The (sat(Z) sat(X)) solution is overcomplete (attacker can change either into dsat).
1342
0
                    return {z.nsat + x.nsat, (z.nsat + x.sat) | (z.sat + x.nsat) | (z.sat + x.sat).SetMalleable().SetNonCanon()};
1343
0
                }
1344
0
                case Fragment::OR_C: {
  Branch (1344:17): [True: 0, False: 0]
  Branch (1344:17): [True: 0, False: 0]
1345
0
                    auto& x = subres[0], &z = subres[1];
1346
0
                    return {INVALID, std::move(x.sat) | (z.sat + x.nsat)};
1347
0
                }
1348
0
                case Fragment::OR_D: {
  Branch (1348:17): [True: 0, False: 0]
  Branch (1348:17): [True: 0, False: 0]
1349
0
                    auto& x = subres[0], &z = subres[1];
1350
0
                    return {z.nsat + x.nsat, std::move(x.sat) | (z.sat + x.nsat)};
1351
0
                }
1352
0
                case Fragment::OR_I: {
  Branch (1352:17): [True: 0, False: 0]
  Branch (1352:17): [True: 0, False: 0]
1353
0
                    auto& x = subres[0], &z = subres[1];
1354
0
                    return {(x.nsat + ONE) | (z.nsat + ZERO), (x.sat + ONE) | (z.sat + ZERO)};
1355
0
                }
1356
0
                case Fragment::ANDOR: {
  Branch (1356:17): [True: 0, False: 0]
  Branch (1356:17): [True: 0, False: 0]
1357
0
                    auto& x = subres[0], &y = subres[1], &z = subres[2];
1358
0
                    return {(y.nsat + x.sat).SetNonCanon() | (z.nsat + x.nsat), (y.sat + x.sat) | (z.sat + x.nsat)};
1359
0
                }
1360
0
                case Fragment::WRAP_A:
  Branch (1360:17): [True: 0, False: 0]
  Branch (1360:17): [True: 0, False: 0]
1361
0
                case Fragment::WRAP_S:
  Branch (1361:17): [True: 0, False: 0]
  Branch (1361:17): [True: 0, False: 0]
1362
0
                case Fragment::WRAP_C:
  Branch (1362:17): [True: 0, False: 0]
  Branch (1362:17): [True: 0, False: 0]
1363
0
                case Fragment::WRAP_N:
  Branch (1363:17): [True: 0, False: 0]
  Branch (1363:17): [True: 0, False: 0]
1364
0
                    return std::move(subres[0]);
1365
0
                case Fragment::WRAP_D: {
  Branch (1365:17): [True: 0, False: 0]
  Branch (1365:17): [True: 0, False: 0]
1366
0
                    auto &x = subres[0];
1367
0
                    return {ZERO, x.sat + ONE};
1368
0
                }
1369
0
                case Fragment::WRAP_J: {
  Branch (1369:17): [True: 0, False: 0]
  Branch (1369:17): [True: 0, False: 0]
1370
0
                    auto &x = subres[0];
1371
                    // If a dissatisfaction with a nonzero top stack element exists, an alternative dissatisfaction exists.
1372
                    // As the dissatisfaction logic currently doesn't keep track of this nonzeroness property, and thus even
1373
                    // if a dissatisfaction with a top zero element is found, we don't know whether another one with a
1374
                    // nonzero top stack element exists. Make the conservative assumption that whenever the subexpression is weakly
1375
                    // dissatisfiable, this alternative dissatisfaction exists and leads to malleability.
1376
0
                    return {InputStack(ZERO).SetMalleable(x.nsat.available != Availability::NO && !x.nsat.has_sig), std::move(x.sat)};
  Branch (1376:59): [True: 0, False: 0]
  Branch (1376:99): [True: 0, False: 0]
  Branch (1376:59): [True: 0, False: 0]
  Branch (1376:99): [True: 0, False: 0]
1377
0
                }
1378
0
                case Fragment::WRAP_V: {
  Branch (1378:17): [True: 0, False: 0]
  Branch (1378:17): [True: 0, False: 0]
1379
0
                    auto &x = subres[0];
1380
0
                    return {INVALID, std::move(x.sat)};
1381
0
                }
1382
0
                case Fragment::JUST_0: return {EMPTY, INVALID};
  Branch (1382:17): [True: 0, False: 0]
  Branch (1382:17): [True: 0, False: 0]
1383
0
                case Fragment::JUST_1: return {INVALID, EMPTY};
  Branch (1383:17): [True: 0, False: 0]
  Branch (1383:17): [True: 0, False: 0]
1384
0
            }
1385
0
            assert(false);
  Branch (1385:13): [Folded - Ignored]
  Branch (1385:13): [Folded - Ignored]
1386
0
            return {INVALID, INVALID};
1387
0
        };
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}::operator()(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>) const
Unexecuted instantiation: miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#1}::operator()(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>) const
1388
1389
0
        auto tester = [&helper](const Node& node, std::span<InputResult> subres) -> InputResult {
1390
0
            auto ret = helper(node, subres);
1391
1392
            // Do a consistency check between the satisfaction code and the type checker
1393
            // (the actual satisfaction code in ProduceInputHelper does not use GetType)
1394
1395
            // For 'z' nodes, available satisfactions/dissatisfactions must have stack size 0.
1396
0
            if (node.GetType() << "z"_mst && ret.nsat.available != Availability::NO) CHECK_NONFATAL(ret.nsat.stack.size() == 0);
  Branch (1396:17): [True: 0, False: 0]
  Branch (1396:17): [True: 0, False: 0]
  Branch (1396:46): [True: 0, False: 0]
  Branch (1396:17): [True: 0, False: 0]
  Branch (1396:17): [True: 0, False: 0]
  Branch (1396:46): [True: 0, False: 0]
1397
0
            if (node.GetType() << "z"_mst && ret.sat.available != Availability::NO) CHECK_NONFATAL(ret.sat.stack.size() == 0);
  Branch (1397:17): [True: 0, False: 0]
  Branch (1397:17): [True: 0, False: 0]
  Branch (1397:46): [True: 0, False: 0]
  Branch (1397:17): [True: 0, False: 0]
  Branch (1397:17): [True: 0, False: 0]
  Branch (1397:46): [True: 0, False: 0]
1398
1399
            // For 'o' nodes, available satisfactions/dissatisfactions must have stack size 1.
1400
0
            if (node.GetType() << "o"_mst && ret.nsat.available != Availability::NO) CHECK_NONFATAL(ret.nsat.stack.size() == 1);
  Branch (1400:17): [True: 0, False: 0]
  Branch (1400:17): [True: 0, False: 0]
  Branch (1400:46): [True: 0, False: 0]
  Branch (1400:17): [True: 0, False: 0]
  Branch (1400:17): [True: 0, False: 0]
  Branch (1400:46): [True: 0, False: 0]
1401
0
            if (node.GetType() << "o"_mst && ret.sat.available != Availability::NO) CHECK_NONFATAL(ret.sat.stack.size() == 1);
  Branch (1401:17): [True: 0, False: 0]
  Branch (1401:17): [True: 0, False: 0]
  Branch (1401:46): [True: 0, False: 0]
  Branch (1401:17): [True: 0, False: 0]
  Branch (1401:17): [True: 0, False: 0]
  Branch (1401:46): [True: 0, False: 0]
1402
1403
            // For 'n' nodes, available satisfactions/dissatisfactions must have stack size 1 or larger. For satisfactions,
1404
            // the top element cannot be 0.
1405
0
            if (node.GetType() << "n"_mst && ret.sat.available != Availability::NO) CHECK_NONFATAL(ret.sat.stack.size() >= 1);
  Branch (1405:17): [True: 0, False: 0]
  Branch (1405:17): [True: 0, False: 0]
  Branch (1405:46): [True: 0, False: 0]
  Branch (1405:17): [True: 0, False: 0]
  Branch (1405:17): [True: 0, False: 0]
  Branch (1405:46): [True: 0, False: 0]
1406
0
            if (node.GetType() << "n"_mst && ret.nsat.available != Availability::NO) CHECK_NONFATAL(ret.nsat.stack.size() >= 1);
  Branch (1406:17): [True: 0, False: 0]
  Branch (1406:17): [True: 0, False: 0]
  Branch (1406:46): [True: 0, False: 0]
  Branch (1406:17): [True: 0, False: 0]
  Branch (1406:17): [True: 0, False: 0]
  Branch (1406:46): [True: 0, False: 0]
1407
0
            if (node.GetType() << "n"_mst && ret.sat.available != Availability::NO) CHECK_NONFATAL(!ret.sat.stack.back().empty());
  Branch (1407:17): [True: 0, False: 0]
  Branch (1407:17): [True: 0, False: 0]
  Branch (1407:46): [True: 0, False: 0]
  Branch (1407:17): [True: 0, False: 0]
  Branch (1407:17): [True: 0, False: 0]
  Branch (1407:46): [True: 0, False: 0]
1408
1409
            // For 'd' nodes, a dissatisfaction must exist, and they must not need a signature. If it is non-malleable,
1410
            // it must be canonical.
1411
0
            if (node.GetType() << "d"_mst) CHECK_NONFATAL(ret.nsat.available != Availability::NO);
  Branch (1411:17): [True: 0, False: 0]
  Branch (1411:17): [True: 0, False: 0]
1412
0
            if (node.GetType() << "d"_mst) CHECK_NONFATAL(!ret.nsat.has_sig);
  Branch (1412:17): [True: 0, False: 0]
  Branch (1412:17): [True: 0, False: 0]
1413
0
            if (node.GetType() << "d"_mst && !ret.nsat.malleable) CHECK_NONFATAL(!ret.nsat.non_canon);
  Branch (1413:17): [True: 0, False: 0]
  Branch (1413:17): [True: 0, False: 0]
  Branch (1413:46): [True: 0, False: 0]
  Branch (1413:17): [True: 0, False: 0]
  Branch (1413:17): [True: 0, False: 0]
  Branch (1413:46): [True: 0, False: 0]
1414
1415
            // For 'f'/'s' nodes, dissatisfactions/satisfactions must have a signature.
1416
0
            if (node.GetType() << "f"_mst && ret.nsat.available != Availability::NO) CHECK_NONFATAL(ret.nsat.has_sig);
  Branch (1416:17): [True: 0, False: 0]
  Branch (1416:17): [True: 0, False: 0]
  Branch (1416:46): [True: 0, False: 0]
  Branch (1416:17): [True: 0, False: 0]
  Branch (1416:17): [True: 0, False: 0]
  Branch (1416:46): [True: 0, False: 0]
1417
0
            if (node.GetType() << "s"_mst && ret.sat.available != Availability::NO) CHECK_NONFATAL(ret.sat.has_sig);
  Branch (1417:17): [True: 0, False: 0]
  Branch (1417:17): [True: 0, False: 0]
  Branch (1417:46): [True: 0, False: 0]
  Branch (1417:17): [True: 0, False: 0]
  Branch (1417:17): [True: 0, False: 0]
  Branch (1417:46): [True: 0, False: 0]
1418
1419
            // For non-malleable 'e' nodes, a non-malleable dissatisfaction must exist.
1420
0
            if (node.GetType() << "me"_mst) CHECK_NONFATAL(ret.nsat.available != Availability::NO);
  Branch (1420:17): [True: 0, False: 0]
  Branch (1420:17): [True: 0, False: 0]
1421
0
            if (node.GetType() << "me"_mst) CHECK_NONFATAL(!ret.nsat.malleable);
  Branch (1421:17): [True: 0, False: 0]
  Branch (1421:17): [True: 0, False: 0]
1422
1423
            // For 'm' nodes, if a satisfaction exists, it must be non-malleable.
1424
0
            if (node.GetType() << "m"_mst && ret.sat.available != Availability::NO) CHECK_NONFATAL(!ret.sat.malleable);
  Branch (1424:17): [True: 0, False: 0]
  Branch (1424:17): [True: 0, False: 0]
  Branch (1424:46): [True: 0, False: 0]
  Branch (1424:17): [True: 0, False: 0]
  Branch (1424:17): [True: 0, False: 0]
  Branch (1424:46): [True: 0, False: 0]
1425
1426
            // If a non-malleable satisfaction exists, it must be canonical.
1427
0
            if (ret.sat.available != Availability::NO && !ret.sat.malleable) CHECK_NONFATAL(!ret.sat.non_canon);
  Branch (1427:17): [True: 0, False: 0]
  Branch (1427:58): [True: 0, False: 0]
  Branch (1427:17): [True: 0, False: 0]
  Branch (1427:58): [True: 0, False: 0]
1428
1429
0
            return ret;
1430
0
        };
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}::operator()(miniscript::Node<XOnlyPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>) const
Unexecuted instantiation: miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>)#2}::operator()(miniscript::Node<CPubKey> const&, std::span<miniscript::internal::InputResult, 18446744073709551615ul>) const
1431
1432
0
        return TreeEval<InputResult>(tester);
1433
0
    }
Unexecuted instantiation: miniscript::internal::InputResult miniscript::Node<XOnlyPubKey>::ProduceInput<TapSatisfier>(TapSatisfier const&) const
Unexecuted instantiation: miniscript::internal::InputResult miniscript::Node<CPubKey>::ProduceInput<WshSatisfier>(WshSatisfier const&) const
1434
1435
public:
1436
    /** Update duplicate key information in this Node.
1437
     *
1438
     * This uses a custom key comparator provided by the context in order to still detect duplicates
1439
     * for more complicated types.
1440
     */
1441
    template<typename Ctx> void DuplicateKeyCheck(const Ctx& ctx) const
1442
0
    {
1443
        // We cannot use a lambda here, as lambdas are non assignable, and the set operations
1444
        // below require moving the comparators around.
1445
0
        struct Comp {
1446
0
            const Ctx* ctx_ptr;
1447
0
            Comp(const Ctx& ctx) : ctx_ptr(&ctx) {}
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp::Comp((anonymous namespace)::KeyParser const&)
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp::Comp(TapSatisfier const&)
Unexecuted instantiation: miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp::Comp(WshSatisfier const&)
1448
0
            bool operator()(const Key& a, const Key& b) const { return ctx_ptr->KeyCompare(a, b); }
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp::operator()(unsigned int const&, unsigned int const&) const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp::operator()(XOnlyPubKey const&, XOnlyPubKey const&) const
Unexecuted instantiation: miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp::operator()(CPubKey const&, CPubKey const&) const
1449
0
        };
1450
1451
        // state in the recursive computation:
1452
        // - std::nullopt means "this node has duplicates"
1453
        // - an std::set means "this node has no duplicate keys, and they are: ...".
1454
0
        using keyset = std::set<Key, Comp>;
1455
0
        using state = std::optional<keyset>;
1456
1457
0
        auto upfn = [&ctx](const Node& node, std::span<state> subs) -> state {
1458
            // If this node is already known to have duplicates, nothing left to do.
1459
0
            if (node.has_duplicate_keys.has_value() && *node.has_duplicate_keys) return {};
  Branch (1459:17): [True: 0, False: 0]
  Branch (1459:56): [True: 0, False: 0]
  Branch (1459:17): [True: 0, False: 0]
  Branch (1459:56): [True: 0, False: 0]
  Branch (1459:17): [True: 0, False: 0]
  Branch (1459:56): [True: 0, False: 0]
1460
1461
            // Check if one of the children is already known to have duplicates.
1462
0
            for (auto& sub : subs) {
  Branch (1462:28): [True: 0, False: 0]
  Branch (1462:28): [True: 0, False: 0]
  Branch (1462:28): [True: 0, False: 0]
1463
0
                if (!sub.has_value()) {
  Branch (1463:21): [True: 0, False: 0]
  Branch (1463:21): [True: 0, False: 0]
  Branch (1463:21): [True: 0, False: 0]
1464
0
                    node.has_duplicate_keys = true;
1465
0
                    return {};
1466
0
                }
1467
0
            }
1468
1469
            // Start building the set of keys involved in this node and children.
1470
            // Start by keys in this node directly.
1471
0
            size_t keys_count = node.keys.size();
1472
0
            keyset key_set{node.keys.begin(), node.keys.end(), Comp(ctx)};
1473
0
            if (key_set.size() != keys_count) {
  Branch (1473:17): [True: 0, False: 0]
  Branch (1473:17): [True: 0, False: 0]
  Branch (1473:17): [True: 0, False: 0]
1474
                // It already has duplicates; bail out.
1475
0
                node.has_duplicate_keys = true;
1476
0
                return {};
1477
0
            }
1478
1479
            // Merge the keys from the children into this set.
1480
0
            for (auto& sub : subs) {
  Branch (1480:28): [True: 0, False: 0]
  Branch (1480:28): [True: 0, False: 0]
  Branch (1480:28): [True: 0, False: 0]
1481
0
                keys_count += sub->size();
1482
                // Small optimization: std::set::merge is linear in the size of the second arg but
1483
                // logarithmic in the size of the first.
1484
0
                if (key_set.size() < sub->size()) std::swap(key_set, *sub);
  Branch (1484:21): [True: 0, False: 0]
  Branch (1484:21): [True: 0, False: 0]
  Branch (1484:21): [True: 0, False: 0]
1485
0
                key_set.merge(*sub);
1486
0
                if (key_set.size() != keys_count) {
  Branch (1486:21): [True: 0, False: 0]
  Branch (1486:21): [True: 0, False: 0]
  Branch (1486:21): [True: 0, False: 0]
1487
0
                    node.has_duplicate_keys = true;
1488
0
                    return {};
1489
0
                }
1490
0
            }
1491
1492
0
            node.has_duplicate_keys = false;
1493
0
            return key_set;
1494
0
        };
Unexecuted instantiation: descriptor.cpp:miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::{lambda(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>(auto:1 const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>)#1}::operator()(miniscript::Node<unsigned int> const&, std::span<std::optional<std::set<unsigned int, miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const::Comp, std::allocator<unsigned int> > >, 18446744073709551615ul>) const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::{lambda(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(auto:1 const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>)#1}::operator()(miniscript::Node<XOnlyPubKey> const&, std::span<std::optional<std::set<XOnlyPubKey, miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const::Comp, std::allocator<XOnlyPubKey> > >, 18446744073709551615ul>) const
Unexecuted instantiation: miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::{lambda(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(auto:1 const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>)#1}::operator()(miniscript::Node<CPubKey> const&, std::span<std::optional<std::set<CPubKey, miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const::Comp, std::allocator<CPubKey> > >, 18446744073709551615ul>) const
1495
1496
0
        TreeEval<state>(upfn);
1497
0
    }
Unexecuted instantiation: descriptor.cpp:void miniscript::Node<unsigned int>::DuplicateKeyCheck<(anonymous namespace)::KeyParser>((anonymous namespace)::KeyParser const&) const
Unexecuted instantiation: void miniscript::Node<XOnlyPubKey>::DuplicateKeyCheck<TapSatisfier>(TapSatisfier const&) const
Unexecuted instantiation: void miniscript::Node<CPubKey>::DuplicateKeyCheck<WshSatisfier>(WshSatisfier const&) const
1498
1499
    //! Return the size of the script for this expression (faster than ToScript().size()).
1500
0
    size_t ScriptSize() const { return scriptlen; }
Unexecuted instantiation: miniscript::Node<unsigned int>::ScriptSize() const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::ScriptSize() const
Unexecuted instantiation: miniscript::Node<CPubKey>::ScriptSize() const
1501
1502
    //! Return the maximum number of ops needed to satisfy this script non-malleably.
1503
0
    std::optional<uint32_t> GetOps() const {
1504
0
        if (!ops.sat.valid) return {};
  Branch (1504:13): [True: 0, False: 0]
1505
0
        return ops.count + ops.sat.value;
1506
0
    }
1507
1508
    //! Return the number of ops in the script (not counting the dynamic ones that depend on execution).
1509
    uint32_t GetStaticOps() const { return ops.count; }
1510
1511
    //! Check the ops limit of this script against the consensus limit.
1512
0
    bool CheckOpsLimit() const {
1513
0
        if (IsTapscript(m_script_ctx)) return true;
  Branch (1513:13): [True: 0, False: 0]
1514
0
        if (const auto ops = GetOps()) return *ops <= MAX_OPS_PER_SCRIPT;
  Branch (1514:24): [True: 0, False: 0]
1515
0
        return true;
1516
0
    }
1517
1518
    /** Whether this node is of type B, K or W. (That is, anything but V.) */
1519
0
    bool IsBKW() const {
1520
0
        return !((GetType() & "BKW"_mst) == ""_mst);
1521
0
    }
1522
1523
    /** Return the maximum number of stack elements needed to satisfy this script non-malleably. */
1524
0
    std::optional<uint32_t> GetStackSize() const {
1525
0
        if (!ss.sat.valid) return {};
  Branch (1525:13): [True: 0, False: 0]
1526
0
        return ss.sat.netdiff + static_cast<int32_t>(IsBKW());
1527
0
    }
1528
1529
    //! Return the maximum size of the stack during execution of this script.
1530
0
    std::optional<uint32_t> GetExecStackSize() const {
1531
0
        if (!ss.sat.valid) return {};
  Branch (1531:13): [True: 0, False: 0]
1532
0
        return ss.sat.exec + static_cast<int32_t>(IsBKW());
1533
0
    }
1534
1535
    //! Check the maximum stack size for this script against the policy limit.
1536
0
    bool CheckStackSize() const {
1537
        // Since in Tapscript there is no standardness limit on the script and witness sizes, we may run
1538
        // into the maximum stack size while executing the script. Make sure it doesn't happen.
1539
0
        if (IsTapscript(m_script_ctx)) {
  Branch (1539:13): [True: 0, False: 0]
1540
0
            if (const auto exec_ss = GetExecStackSize()) return exec_ss <= MAX_STACK_SIZE;
  Branch (1540:28): [True: 0, False: 0]
1541
0
            return true;
1542
0
        }
1543
0
        if (const auto ss = GetStackSize()) return *ss <= MAX_STANDARD_P2WSH_STACK_ITEMS;
  Branch (1543:24): [True: 0, False: 0]
1544
0
        return true;
1545
0
    }
1546
1547
    //! Whether no satisfaction exists for this node.
1548
0
    bool IsNotSatisfiable() const { return !GetStackSize(); }
1549
1550
    /** Return the maximum size in bytes of a witness to satisfy this script non-malleably. Note this does
1551
     * not include the witness script push. */
1552
0
    std::optional<uint32_t> GetWitnessSize() const {
1553
0
        if (!ws.sat.valid) return {};
  Branch (1553:13): [True: 0, False: 0]
1554
0
        return ws.sat.value;
1555
0
    }
1556
1557
    //! Return the expression type.
1558
0
    Type GetType() const { return typ; }
Unexecuted instantiation: miniscript::Node<unsigned int>::GetType() const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::GetType() const
Unexecuted instantiation: miniscript::Node<CPubKey>::GetType() const
1559
1560
    //! Return the script context for this node.
1561
0
    MiniscriptContext GetMsCtx() const { return m_script_ctx; }
1562
1563
    //! Find an insane subnode which has no insane children. Nullptr if there is none.
1564
0
    const Node* FindInsaneSub() const {
1565
0
        return TreeEval<const Node*>([](const Node& node, std::span<const Node*> subs) -> const Node* {
1566
0
            for (auto& sub: subs) if (sub) return sub;
  Branch (1566:27): [True: 0, False: 0]
  Branch (1566:39): [True: 0, False: 0]
1567
0
            if (!node.IsSaneSubexpression()) return &node;
  Branch (1567:17): [True: 0, False: 0]
1568
0
            return nullptr;
1569
0
        });
1570
0
    }
1571
1572
    //! Determine whether a Miniscript node is satisfiable. fn(node) will be invoked for all
1573
    //! key, time, and hashing nodes, and should return their satisfiability.
1574
    template<typename F>
1575
    bool IsSatisfiable(F fn) const
1576
    {
1577
        // TreeEval() doesn't support bool as NodeType, so use int instead.
1578
        return TreeEval<int>([&fn](const Node& node, std::span<int> subs) -> bool {
1579
            switch (node.fragment) {
1580
                case Fragment::JUST_0:
1581
                    return false;
1582
                case Fragment::JUST_1:
1583
                    return true;
1584
                case Fragment::PK_K:
1585
                case Fragment::PK_H:
1586
                case Fragment::MULTI:
1587
                case Fragment::MULTI_A:
1588
                case Fragment::AFTER:
1589
                case Fragment::OLDER:
1590
                case Fragment::HASH256:
1591
                case Fragment::HASH160:
1592
                case Fragment::SHA256:
1593
                case Fragment::RIPEMD160:
1594
                    return bool{fn(node)};
1595
                case Fragment::ANDOR:
1596
                    return (subs[0] && subs[1]) || subs[2];
1597
                case Fragment::AND_V:
1598
                case Fragment::AND_B:
1599
                    return subs[0] && subs[1];
1600
                case Fragment::OR_B:
1601
                case Fragment::OR_C:
1602
                case Fragment::OR_D:
1603
                case Fragment::OR_I:
1604
                    return subs[0] || subs[1];
1605
                case Fragment::THRESH:
1606
                    return static_cast<uint32_t>(std::count(subs.begin(), subs.end(), true)) >= node.k;
1607
                default: // wrappers
1608
                    assert(subs.size() >= 1);
1609
                    CHECK_NONFATAL(subs.size() == 1);
1610
                    return subs[0];
1611
            }
1612
        });
1613
    }
1614
1615
    //! Check whether this node is valid at all.
1616
0
    bool IsValid() const {
1617
0
        if (GetType() == ""_mst) return false;
  Branch (1617:13): [True: 0, False: 0]
  Branch (1617:13): [True: 0, False: 0]
  Branch (1617:13): [True: 0, False: 0]
1618
0
        return ScriptSize() <= internal::MaxScriptSize(m_script_ctx);
1619
0
    }
Unexecuted instantiation: miniscript::Node<unsigned int>::IsValid() const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::IsValid() const
Unexecuted instantiation: miniscript::Node<CPubKey>::IsValid() const
1620
1621
    //! Check whether this node is valid as a script on its own.
1622
0
    bool IsValidTopLevel() const { return IsValid() && GetType() << "B"_mst; }
Unexecuted instantiation: miniscript::Node<unsigned int>::IsValidTopLevel() const
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::IsValidTopLevel() const
Unexecuted instantiation: miniscript::Node<CPubKey>::IsValidTopLevel() const
  Branch (1622:43): [True: 0, False: 0]
  Branch (1622:56): [True: 0, False: 0]
  Branch (1622:43): [True: 0, False: 0]
  Branch (1622:56): [True: 0, False: 0]
  Branch (1622:43): [True: 0, False: 0]
  Branch (1622:56): [True: 0, False: 0]
1623
1624
    //! Check whether this script can always be satisfied in a non-malleable way.
1625
0
    bool IsNonMalleable() const { return GetType() << "m"_mst; }
1626
1627
    //! Check whether this script always needs a signature.
1628
0
    bool NeedsSignature() const { return GetType() << "s"_mst; }
1629
1630
    //! Check whether there is no satisfaction path that contains both timelocks and heightlocks
1631
0
    bool CheckTimeLocksMix() const { return GetType() << "k"_mst; }
1632
1633
    //! Check whether there is no duplicate key across this fragment and all its sub-fragments.
1634
0
    bool CheckDuplicateKey() const { return has_duplicate_keys && !*has_duplicate_keys; }
  Branch (1634:45): [True: 0, False: 0]
  Branch (1634:67): [True: 0, False: 0]
1635
1636
    //! Whether successful non-malleable satisfactions are guaranteed to be valid.
1637
0
    bool ValidSatisfactions() const { return IsValid() && CheckOpsLimit() && CheckStackSize(); }
  Branch (1637:46): [True: 0, False: 0]
  Branch (1637:59): [True: 0, False: 0]
  Branch (1637:78): [True: 0, False: 0]
1638
1639
    //! Whether the apparent policy of this node matches its script semantics. Doesn't guarantee it is a safe script on its own.
1640
0
    bool IsSaneSubexpression() const { return ValidSatisfactions() && IsNonMalleable() && CheckTimeLocksMix() && CheckDuplicateKey(); }
  Branch (1640:47): [True: 0, False: 0]
  Branch (1640:71): [True: 0, False: 0]
  Branch (1640:91): [True: 0, False: 0]
  Branch (1640:114): [True: 0, False: 0]
1641
1642
    //! Check whether this node is safe as a script on its own.
1643
0
    bool IsSane() const { return IsValidTopLevel() && IsSaneSubexpression() && NeedsSignature(); }
  Branch (1643:34): [True: 0, False: 0]
  Branch (1643:55): [True: 0, False: 0]
  Branch (1643:80): [True: 0, False: 0]
1644
1645
    //! Produce a witness for this script, if possible and given the information available in the context.
1646
    //! The non-malleable satisfaction is guaranteed to be valid if it exists, and ValidSatisfaction()
1647
    //! is true. If IsSane() holds, this satisfaction is guaranteed to succeed in case the node's
1648
    //! conditions are satisfied (private keys and hash preimages available, locktimes satisfied).
1649
    template<typename Ctx>
1650
0
    Availability Satisfy(const Ctx& ctx, std::vector<std::vector<unsigned char>>& stack, bool nonmalleable = true) const {
1651
0
        auto ret = ProduceInput(ctx);
1652
0
        if (nonmalleable && (ret.sat.malleable || !ret.sat.has_sig)) return Availability::NO;
  Branch (1652:13): [True: 0, False: 0]
  Branch (1652:30): [True: 0, False: 0]
  Branch (1652:51): [True: 0, False: 0]
  Branch (1652:13): [True: 0, False: 0]
  Branch (1652:30): [True: 0, False: 0]
  Branch (1652:51): [True: 0, False: 0]
1653
0
        stack = std::move(ret.sat.stack);
1654
0
        return ret.sat.available;
1655
0
    }
Unexecuted instantiation: miniscript::Availability miniscript::Node<XOnlyPubKey>::Satisfy<TapSatisfier>(TapSatisfier const&, std::vector<std::vector<unsigned char, std::allocator<unsigned char> >, std::allocator<std::vector<unsigned char, std::allocator<unsigned char> > > >&, bool) const
Unexecuted instantiation: miniscript::Availability miniscript::Node<CPubKey>::Satisfy<WshSatisfier>(WshSatisfier const&, std::vector<std::vector<unsigned char, std::allocator<unsigned char> >, std::allocator<std::vector<unsigned char, std::allocator<unsigned char> > > >&, bool) const
1656
1657
    //! Equality testing.
1658
    bool operator==(const Node<Key>& arg) const { return Compare(*this, arg) == 0; }
1659
1660
    // Constructors with various argument combinations, which bypass the duplicate key check.
1661
    Node(internal::NoDupCheck, MiniscriptContext script_ctx, Fragment nt, std::vector<NodeRef<Key>> sub, std::vector<unsigned char> arg, uint32_t val = 0)
1662
        : fragment(nt), k(val), data(std::move(arg)), subs(std::move(sub)), m_script_ctx{script_ctx}, ops(CalcOps()), ss(CalcStackSize()), ws(CalcWitnessSize()), typ(CalcType()), scriptlen(CalcScriptLen()) {}
1663
    Node(internal::NoDupCheck, MiniscriptContext script_ctx, Fragment nt, std::vector<unsigned char> arg, uint32_t val = 0)
1664
0
        : fragment(nt), k(val), data(std::move(arg)), m_script_ctx{script_ctx}, ops(CalcOps()), ss(CalcStackSize()), ws(CalcWitnessSize()), typ(CalcType()), scriptlen(CalcScriptLen()) {}
Unexecuted instantiation: miniscript::Node<unsigned int>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<unsigned char, std::allocator<unsigned char> >, unsigned int)
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<unsigned char, std::allocator<unsigned char> >, unsigned int)
Unexecuted instantiation: miniscript::Node<CPubKey>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<unsigned char, std::allocator<unsigned char> >, unsigned int)
1665
    Node(internal::NoDupCheck, MiniscriptContext script_ctx, Fragment nt, std::vector<NodeRef<Key>> sub, std::vector<Key> key, uint32_t val = 0)
1666
        : fragment(nt), k(val), keys(std::move(key)), m_script_ctx{script_ctx}, subs(std::move(sub)), ops(CalcOps()), ss(CalcStackSize()), ws(CalcWitnessSize()), typ(CalcType()), scriptlen(CalcScriptLen()) {}
1667
    Node(internal::NoDupCheck, MiniscriptContext script_ctx, Fragment nt, std::vector<Key> key, uint32_t val = 0)
1668
0
        : fragment(nt), k(val), keys(std::move(key)), m_script_ctx{script_ctx}, ops(CalcOps()), ss(CalcStackSize()), ws(CalcWitnessSize()), typ(CalcType()), scriptlen(CalcScriptLen()) {}
Unexecuted instantiation: miniscript::Node<unsigned int>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int)
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<XOnlyPubKey, std::allocator<XOnlyPubKey> >, unsigned int)
Unexecuted instantiation: miniscript::Node<CPubKey>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<CPubKey, std::allocator<CPubKey> >, unsigned int)
1669
    Node(internal::NoDupCheck, MiniscriptContext script_ctx, Fragment nt, std::vector<NodeRef<Key>> sub, uint32_t val = 0)
1670
0
        : fragment(nt), k(val), subs(std::move(sub)), m_script_ctx{script_ctx}, ops(CalcOps()), ss(CalcStackSize()), ws(CalcWitnessSize()), typ(CalcType()), scriptlen(CalcScriptLen()) {}
Unexecuted instantiation: miniscript::Node<unsigned int>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, std::allocator<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > > >, unsigned int)
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > > >, unsigned int)
Unexecuted instantiation: miniscript::Node<CPubKey>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > > >, unsigned int)
1671
    Node(internal::NoDupCheck, MiniscriptContext script_ctx, Fragment nt, uint32_t val = 0)
1672
0
        : fragment(nt), k(val), m_script_ctx{script_ctx}, ops(CalcOps()), ss(CalcStackSize()), ws(CalcWitnessSize()), typ(CalcType()), scriptlen(CalcScriptLen()) {}
Unexecuted instantiation: miniscript::Node<unsigned int>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, unsigned int)
Unexecuted instantiation: miniscript::Node<XOnlyPubKey>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, unsigned int)
Unexecuted instantiation: miniscript::Node<CPubKey>::Node(miniscript::internal::NoDupCheck, miniscript::MiniscriptContext, miniscript::Fragment, unsigned int)
1673
1674
    // Constructors with various argument combinations, which do perform the duplicate key check.
1675
    template <typename Ctx> Node(const Ctx& ctx, Fragment nt, std::vector<NodeRef<Key>> sub, std::vector<unsigned char> arg, uint32_t val = 0)
1676
        : Node(internal::NoDupCheck{}, ctx.MsContext(), nt, std::move(sub), std::move(arg), val) { DuplicateKeyCheck(ctx); }
1677
    template <typename Ctx> Node(const Ctx& ctx, Fragment nt, std::vector<unsigned char> arg, uint32_t val = 0)
1678
        : Node(internal::NoDupCheck{}, ctx.MsContext(), nt, std::move(arg), val) { DuplicateKeyCheck(ctx);}
1679
    template <typename Ctx> Node(const Ctx& ctx, Fragment nt, std::vector<NodeRef<Key>> sub, std::vector<Key> key, uint32_t val = 0)
1680
        : Node(internal::NoDupCheck{}, ctx.MsContext(), nt, std::move(sub), std::move(key), val) { DuplicateKeyCheck(ctx); }
1681
    template <typename Ctx> Node(const Ctx& ctx, Fragment nt, std::vector<Key> key, uint32_t val = 0)
1682
        : Node(internal::NoDupCheck{}, ctx.MsContext(), nt, std::move(key), val) { DuplicateKeyCheck(ctx); }
1683
    template <typename Ctx> Node(const Ctx& ctx, Fragment nt, std::vector<NodeRef<Key>> sub, uint32_t val = 0)
1684
        : Node(internal::NoDupCheck{}, ctx.MsContext(), nt, std::move(sub), val) { DuplicateKeyCheck(ctx); }
1685
    template <typename Ctx> Node(const Ctx& ctx, Fragment nt, uint32_t val = 0)
1686
        : Node(internal::NoDupCheck{}, ctx.MsContext(), nt, val) { DuplicateKeyCheck(ctx); }
1687
1688
    // Delete copy constructor and assignment operator, use Clone() instead
1689
    Node(const Node&) = delete;
1690
    Node& operator=(const Node&) = delete;
1691
};
1692
1693
namespace internal {
1694
1695
enum class ParseContext {
1696
    /** An expression which may be begin with wrappers followed by a colon. */
1697
    WRAPPED_EXPR,
1698
    /** A miniscript expression which does not begin with wrappers. */
1699
    EXPR,
1700
1701
    /** SWAP wraps the top constructed node with s: */
1702
    SWAP,
1703
    /** ALT wraps the top constructed node with a: */
1704
    ALT,
1705
    /** CHECK wraps the top constructed node with c: */
1706
    CHECK,
1707
    /** DUP_IF wraps the top constructed node with d: */
1708
    DUP_IF,
1709
    /** VERIFY wraps the top constructed node with v: */
1710
    VERIFY,
1711
    /** NON_ZERO wraps the top constructed node with j: */
1712
    NON_ZERO,
1713
    /** ZERO_NOTEQUAL wraps the top constructed node with n: */
1714
    ZERO_NOTEQUAL,
1715
    /** WRAP_U will construct an or_i(X,0) node from the top constructed node. */
1716
    WRAP_U,
1717
    /** WRAP_T will construct an and_v(X,1) node from the top constructed node. */
1718
    WRAP_T,
1719
1720
    /** AND_N will construct an andor(X,Y,0) node from the last two constructed nodes. */
1721
    AND_N,
1722
    /** AND_V will construct an and_v node from the last two constructed nodes. */
1723
    AND_V,
1724
    /** AND_B will construct an and_b node from the last two constructed nodes. */
1725
    AND_B,
1726
    /** ANDOR will construct an andor node from the last three constructed nodes. */
1727
    ANDOR,
1728
    /** OR_B will construct an or_b node from the last two constructed nodes. */
1729
    OR_B,
1730
    /** OR_C will construct an or_c node from the last two constructed nodes. */
1731
    OR_C,
1732
    /** OR_D will construct an or_d node from the last two constructed nodes. */
1733
    OR_D,
1734
    /** OR_I will construct an or_i node from the last two constructed nodes. */
1735
    OR_I,
1736
1737
    /** THRESH will read a wrapped expression, and then look for a COMMA. If
1738
     * no comma follows, it will construct a thresh node from the appropriate
1739
     * number of constructed children. Otherwise, it will recurse with another
1740
     * THRESH. */
1741
    THRESH,
1742
1743
    /** COMMA expects the next element to be ',' and fails if not. */
1744
    COMMA,
1745
    /** CLOSE_BRACKET expects the next element to be ')' and fails if not. */
1746
    CLOSE_BRACKET,
1747
};
1748
1749
int FindNextChar(std::span<const char> in, const char m);
1750
1751
/** Parse a key string ending at the end of the fragment's text representation. */
1752
template<typename Key, typename Ctx>
1753
std::optional<std::pair<Key, int>> ParseKeyEnd(std::span<const char> in, const Ctx& ctx)
1754
0
{
1755
0
    int key_size = FindNextChar(in, ')');
1756
0
    if (key_size < 1) return {};
  Branch (1756:9): [True: 0, False: 0]
1757
0
    auto key = ctx.FromString(in.begin(), in.begin() + key_size);
1758
0
    if (!key) return {};
  Branch (1758:9): [True: 0, False: 0]
1759
0
    return {{std::move(*key), key_size}};
1760
0
}
1761
1762
/** Parse a hex string ending at the end of the fragment's text representation. */
1763
template<typename Ctx>
1764
std::optional<std::pair<std::vector<unsigned char>, int>> ParseHexStrEnd(std::span<const char> in, const size_t expected_size,
1765
                                                                         const Ctx& ctx)
1766
0
{
1767
0
    int hash_size = FindNextChar(in, ')');
1768
0
    if (hash_size < 1) return {};
  Branch (1768:9): [True: 0, False: 0]
1769
0
    std::string val = std::string(in.begin(), in.begin() + hash_size);
1770
0
    if (!IsHex(val)) return {};
  Branch (1770:9): [True: 0, False: 0]
1771
0
    auto hash = ParseHex(val);
1772
0
    if (hash.size() != expected_size) return {};
  Branch (1772:9): [True: 0, False: 0]
1773
0
    return {{std::move(hash), hash_size}};
1774
0
}
1775
1776
/** BuildBack pops the last two elements off `constructed` and wraps them in the specified Fragment */
1777
template<typename Key>
1778
void BuildBack(const MiniscriptContext script_ctx, Fragment nt, std::vector<NodeRef<Key>>& constructed, const bool reverse = false)
1779
0
{
1780
0
    NodeRef<Key> child = std::move(constructed.back());
1781
0
    constructed.pop_back();
1782
0
    if (reverse) {
  Branch (1782:9): [True: 0, False: 0]
  Branch (1782:9): [True: 0, False: 0]
  Branch (1782:9): [True: 0, False: 0]
1783
0
        constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, script_ctx, nt, Vector(std::move(child), std::move(constructed.back())));
1784
0
    } else {
1785
0
        constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, script_ctx, nt, Vector(std::move(constructed.back()), std::move(child)));
1786
0
    }
1787
0
}
Unexecuted instantiation: void miniscript::internal::BuildBack<unsigned int>(miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> >, std::allocator<std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > > >&, bool)
Unexecuted instantiation: void miniscript::internal::BuildBack<XOnlyPubKey>(miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > > >&, bool)
Unexecuted instantiation: void miniscript::internal::BuildBack<CPubKey>(miniscript::MiniscriptContext, miniscript::Fragment, std::vector<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> >, std::allocator<std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > > >&, bool)
1788
1789
/**
1790
 * Parse a miniscript from its textual descriptor form.
1791
 * This does not check whether the script is valid, let alone sane. The caller is expected to use
1792
 * the `IsValidTopLevel()` and `IsSaneTopLevel()` to check for these properties on the node.
1793
 */
1794
template<typename Key, typename Ctx>
1795
inline NodeRef<Key> Parse(std::span<const char> in, const Ctx& ctx)
1796
0
{
1797
0
    using namespace script;
1798
1799
    // Account for the minimum script size for all parsed fragments so far. It "borrows" 1
1800
    // script byte from all leaf nodes, counting it instead whenever a space for a recursive
1801
    // expression is added (through andor, and_*, or_*, thresh). This guarantees that all fragments
1802
    // increment the script_size by at least one, except for:
1803
    // - "0", "1": these leafs are only a single byte, so their subtracted-from increment is 0.
1804
    //   This is not an issue however, as "space" for them has to be created by combinators,
1805
    //   which do increment script_size.
1806
    // - "v:": the v wrapper adds nothing as in some cases it results in no opcode being added
1807
    //   (instead transforming another opcode into its VERIFY form). However, the v: wrapper has
1808
    //   to be interleaved with other fragments to be valid, so this is not a concern.
1809
0
    size_t script_size{1};
1810
0
    size_t max_size{internal::MaxScriptSize(ctx.MsContext())};
1811
1812
    // The two integers are used to hold state for thresh()
1813
0
    std::vector<std::tuple<ParseContext, int64_t, int64_t>> to_parse;
1814
0
    std::vector<NodeRef<Key>> constructed;
1815
1816
0
    to_parse.emplace_back(ParseContext::WRAPPED_EXPR, -1, -1);
1817
1818
    // Parses a multi() or multi_a() from its string representation. Returns false on parsing error.
1819
0
    const auto parse_multi_exp = [&](std::span<const char>& in, const bool is_multi_a) -> bool {
1820
0
        const auto max_keys{is_multi_a ? MAX_PUBKEYS_PER_MULTI_A : MAX_PUBKEYS_PER_MULTISIG};
  Branch (1820:29): [True: 0, False: 0]
1821
0
        const auto required_ctx{is_multi_a ? MiniscriptContext::TAPSCRIPT : MiniscriptContext::P2WSH};
  Branch (1821:33): [True: 0, False: 0]
1822
0
        if (ctx.MsContext() != required_ctx) return false;
  Branch (1822:13): [True: 0, False: 0]
1823
        // Get threshold
1824
0
        int next_comma = FindNextChar(in, ',');
1825
0
        if (next_comma < 1) return false;
  Branch (1825:13): [True: 0, False: 0]
1826
0
        const auto k_to_integral{ToIntegral<int64_t>(std::string_view(in.data(), next_comma))};
1827
0
        if (!k_to_integral.has_value()) return false;
  Branch (1827:13): [True: 0, False: 0]
1828
0
        const int64_t k{k_to_integral.value()};
1829
0
        in = in.subspan(next_comma + 1);
1830
        // Get keys. It is compatible for both compressed and x-only keys.
1831
0
        std::vector<Key> keys;
1832
0
        while (next_comma != -1) {
  Branch (1832:16): [True: 0, False: 0]
1833
0
            next_comma = FindNextChar(in, ',');
1834
0
            int key_length = (next_comma == -1) ? FindNextChar(in, ')') : next_comma;
  Branch (1834:30): [True: 0, False: 0]
1835
0
            if (key_length < 1) return false;
  Branch (1835:17): [True: 0, False: 0]
1836
0
            auto key = ctx.FromString(in.begin(), in.begin() + key_length);
1837
0
            if (!key) return false;
  Branch (1837:17): [True: 0, False: 0]
1838
0
            keys.push_back(std::move(*key));
1839
0
            in = in.subspan(key_length + 1);
1840
0
        }
1841
0
        if (keys.size() < 1 || keys.size() > max_keys) return false;
  Branch (1841:13): [True: 0, False: 0]
  Branch (1841:32): [True: 0, False: 0]
1842
0
        if (k < 1 || k > (int64_t)keys.size()) return false;
  Branch (1842:13): [True: 0, False: 0]
  Branch (1842:22): [True: 0, False: 0]
1843
0
        if (is_multi_a) {
  Branch (1843:13): [True: 0, False: 0]
1844
            // (push + xonly-key + CHECKSIG[ADD]) * n + k + OP_NUMEQUAL(VERIFY), minus one.
1845
0
            script_size += (1 + 32 + 1) * keys.size() + BuildScript(k).size();
1846
0
            constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::MULTI_A, std::move(keys), k));
1847
0
        } else {
1848
0
            script_size += 2 + (keys.size() > 16) + (k > 16) + 34 * keys.size();
1849
0
            constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::MULTI, std::move(keys), k));
1850
0
        }
1851
0
        return true;
1852
0
    };
1853
1854
0
    while (!to_parse.empty()) {
  Branch (1854:12): [True: 0, False: 0]
1855
0
        if (script_size > max_size) return {};
  Branch (1855:13): [True: 0, False: 0]
1856
1857
        // Get the current context we are decoding within
1858
0
        auto [cur_context, n, k] = to_parse.back();
1859
0
        to_parse.pop_back();
1860
1861
0
        switch (cur_context) {
  Branch (1861:17): [True: 0, False: 0]
1862
0
        case ParseContext::WRAPPED_EXPR: {
  Branch (1862:9): [True: 0, False: 0]
1863
0
            std::optional<size_t> colon_index{};
1864
0
            for (size_t i = 1; i < in.size(); ++i) {
  Branch (1864:32): [True: 0, False: 0]
1865
0
                if (in[i] == ':') {
  Branch (1865:21): [True: 0, False: 0]
1866
0
                    colon_index = i;
1867
0
                    break;
1868
0
                }
1869
0
                if (in[i] < 'a' || in[i] > 'z') break;
  Branch (1869:21): [True: 0, False: 0]
  Branch (1869:36): [True: 0, False: 0]
1870
0
            }
1871
            // If there is no colon, this loop won't execute
1872
0
            bool last_was_v{false};
1873
0
            for (size_t j = 0; colon_index && j < *colon_index; ++j) {
  Branch (1873:32): [True: 0, False: 0]
  Branch (1873:47): [True: 0, False: 0]
1874
0
                if (script_size > max_size) return {};
  Branch (1874:21): [True: 0, False: 0]
1875
0
                if (in[j] == 'a') {
  Branch (1875:21): [True: 0, False: 0]
1876
0
                    script_size += 2;
1877
0
                    to_parse.emplace_back(ParseContext::ALT, -1, -1);
1878
0
                } else if (in[j] == 's') {
  Branch (1878:28): [True: 0, False: 0]
1879
0
                    script_size += 1;
1880
0
                    to_parse.emplace_back(ParseContext::SWAP, -1, -1);
1881
0
                } else if (in[j] == 'c') {
  Branch (1881:28): [True: 0, False: 0]
1882
0
                    script_size += 1;
1883
0
                    to_parse.emplace_back(ParseContext::CHECK, -1, -1);
1884
0
                } else if (in[j] == 'd') {
  Branch (1884:28): [True: 0, False: 0]
1885
0
                    script_size += 3;
1886
0
                    to_parse.emplace_back(ParseContext::DUP_IF, -1, -1);
1887
0
                } else if (in[j] == 'j') {
  Branch (1887:28): [True: 0, False: 0]
1888
0
                    script_size += 4;
1889
0
                    to_parse.emplace_back(ParseContext::NON_ZERO, -1, -1);
1890
0
                } else if (in[j] == 'n') {
  Branch (1890:28): [True: 0, False: 0]
1891
0
                    script_size += 1;
1892
0
                    to_parse.emplace_back(ParseContext::ZERO_NOTEQUAL, -1, -1);
1893
0
                } else if (in[j] == 'v') {
  Branch (1893:28): [True: 0, False: 0]
1894
                    // do not permit "...vv...:"; it's not valid, and also doesn't trigger early
1895
                    // failure as script_size isn't incremented.
1896
0
                    if (last_was_v) return {};
  Branch (1896:25): [True: 0, False: 0]
1897
0
                    to_parse.emplace_back(ParseContext::VERIFY, -1, -1);
1898
0
                } else if (in[j] == 'u') {
  Branch (1898:28): [True: 0, False: 0]
1899
0
                    script_size += 4;
1900
0
                    to_parse.emplace_back(ParseContext::WRAP_U, -1, -1);
1901
0
                } else if (in[j] == 't') {
  Branch (1901:28): [True: 0, False: 0]
1902
0
                    script_size += 1;
1903
0
                    to_parse.emplace_back(ParseContext::WRAP_T, -1, -1);
1904
0
                } else if (in[j] == 'l') {
  Branch (1904:28): [True: 0, False: 0]
1905
                    // The l: wrapper is equivalent to or_i(0,X)
1906
0
                    script_size += 4;
1907
0
                    constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::JUST_0));
1908
0
                    to_parse.emplace_back(ParseContext::OR_I, -1, -1);
1909
0
                } else {
1910
0
                    return {};
1911
0
                }
1912
0
                last_was_v = (in[j] == 'v');
1913
0
            }
1914
0
            to_parse.emplace_back(ParseContext::EXPR, -1, -1);
1915
0
            if (colon_index) in = in.subspan(*colon_index + 1);
  Branch (1915:17): [True: 0, False: 0]
1916
0
            break;
1917
0
        }
1918
0
        case ParseContext::EXPR: {
  Branch (1918:9): [True: 0, False: 0]
1919
0
            if (Const("0", in)) {
  Branch (1919:17): [True: 0, False: 0]
1920
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::JUST_0));
1921
0
            } else if (Const("1", in)) {
  Branch (1921:24): [True: 0, False: 0]
1922
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::JUST_1));
1923
0
            } else if (Const("pk(", in)) {
  Branch (1923:24): [True: 0, False: 0]
1924
0
                auto res = ParseKeyEnd<Key, Ctx>(in, ctx);
1925
0
                if (!res) return {};
  Branch (1925:21): [True: 0, False: 0]
1926
0
                auto& [key, key_size] = *res;
1927
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_C, Vector(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::PK_K, Vector(std::move(key))))));
1928
0
                in = in.subspan(key_size + 1);
1929
0
                script_size += IsTapscript(ctx.MsContext()) ? 33 : 34;
  Branch (1929:32): [True: 0, False: 0]
1930
0
            } else if (Const("pkh(", in)) {
  Branch (1930:24): [True: 0, False: 0]
1931
0
                auto res = ParseKeyEnd<Key>(in, ctx);
1932
0
                if (!res) return {};
  Branch (1932:21): [True: 0, False: 0]
1933
0
                auto& [key, key_size] = *res;
1934
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_C, Vector(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::PK_H, Vector(std::move(key))))));
1935
0
                in = in.subspan(key_size + 1);
1936
0
                script_size += 24;
1937
0
            } else if (Const("pk_k(", in)) {
  Branch (1937:24): [True: 0, False: 0]
1938
0
                auto res = ParseKeyEnd<Key>(in, ctx);
1939
0
                if (!res) return {};
  Branch (1939:21): [True: 0, False: 0]
1940
0
                auto& [key, key_size] = *res;
1941
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::PK_K, Vector(std::move(key))));
1942
0
                in = in.subspan(key_size + 1);
1943
0
                script_size += IsTapscript(ctx.MsContext()) ? 32 : 33;
  Branch (1943:32): [True: 0, False: 0]
1944
0
            } else if (Const("pk_h(", in)) {
  Branch (1944:24): [True: 0, False: 0]
1945
0
                auto res = ParseKeyEnd<Key>(in, ctx);
1946
0
                if (!res) return {};
  Branch (1946:21): [True: 0, False: 0]
1947
0
                auto& [key, key_size] = *res;
1948
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::PK_H, Vector(std::move(key))));
1949
0
                in = in.subspan(key_size + 1);
1950
0
                script_size += 23;
1951
0
            } else if (Const("sha256(", in)) {
  Branch (1951:24): [True: 0, False: 0]
1952
0
                auto res = ParseHexStrEnd(in, 32, ctx);
1953
0
                if (!res) return {};
  Branch (1953:21): [True: 0, False: 0]
1954
0
                auto& [hash, hash_size] = *res;
1955
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::SHA256, std::move(hash)));
1956
0
                in = in.subspan(hash_size + 1);
1957
0
                script_size += 38;
1958
0
            } else if (Const("ripemd160(", in)) {
  Branch (1958:24): [True: 0, False: 0]
1959
0
                auto res = ParseHexStrEnd(in, 20, ctx);
1960
0
                if (!res) return {};
  Branch (1960:21): [True: 0, False: 0]
1961
0
                auto& [hash, hash_size] = *res;
1962
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::RIPEMD160, std::move(hash)));
1963
0
                in = in.subspan(hash_size + 1);
1964
0
                script_size += 26;
1965
0
            } else if (Const("hash256(", in)) {
  Branch (1965:24): [True: 0, False: 0]
1966
0
                auto res = ParseHexStrEnd(in, 32, ctx);
1967
0
                if (!res) return {};
  Branch (1967:21): [True: 0, False: 0]
1968
0
                auto& [hash, hash_size] = *res;
1969
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::HASH256, std::move(hash)));
1970
0
                in = in.subspan(hash_size + 1);
1971
0
                script_size += 38;
1972
0
            } else if (Const("hash160(", in)) {
  Branch (1972:24): [True: 0, False: 0]
1973
0
                auto res = ParseHexStrEnd(in, 20, ctx);
1974
0
                if (!res) return {};
  Branch (1974:21): [True: 0, False: 0]
1975
0
                auto& [hash, hash_size] = *res;
1976
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::HASH160, std::move(hash)));
1977
0
                in = in.subspan(hash_size + 1);
1978
0
                script_size += 26;
1979
0
            } else if (Const("after(", in)) {
  Branch (1979:24): [True: 0, False: 0]
1980
0
                int arg_size = FindNextChar(in, ')');
1981
0
                if (arg_size < 1) return {};
  Branch (1981:21): [True: 0, False: 0]
1982
0
                const auto num{ToIntegral<int64_t>(std::string_view(in.data(), arg_size))};
1983
0
                if (!num.has_value() || *num < 1 || *num >= 0x80000000L) return {};
  Branch (1983:21): [True: 0, False: 0]
  Branch (1983:41): [True: 0, False: 0]
  Branch (1983:53): [True: 0, False: 0]
1984
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::AFTER, *num));
1985
0
                in = in.subspan(arg_size + 1);
1986
0
                script_size += 1 + (*num > 16) + (*num > 0x7f) + (*num > 0x7fff) + (*num > 0x7fffff);
1987
0
            } else if (Const("older(", in)) {
  Branch (1987:24): [True: 0, False: 0]
1988
0
                int arg_size = FindNextChar(in, ')');
1989
0
                if (arg_size < 1) return {};
  Branch (1989:21): [True: 0, False: 0]
1990
0
                const auto num{ToIntegral<int64_t>(std::string_view(in.data(), arg_size))};
1991
0
                if (!num.has_value() || *num < 1 || *num >= 0x80000000L) return {};
  Branch (1991:21): [True: 0, False: 0]
  Branch (1991:41): [True: 0, False: 0]
  Branch (1991:53): [True: 0, False: 0]
1992
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::OLDER, *num));
1993
0
                in = in.subspan(arg_size + 1);
1994
0
                script_size += 1 + (*num > 16) + (*num > 0x7f) + (*num > 0x7fff) + (*num > 0x7fffff);
1995
0
            } else if (Const("multi(", in)) {
  Branch (1995:24): [True: 0, False: 0]
1996
0
                if (!parse_multi_exp(in, /* is_multi_a = */false)) return {};
  Branch (1996:21): [True: 0, False: 0]
1997
0
            } else if (Const("multi_a(", in)) {
  Branch (1997:24): [True: 0, False: 0]
1998
0
                if (!parse_multi_exp(in, /* is_multi_a = */true)) return {};
  Branch (1998:21): [True: 0, False: 0]
1999
0
            } else if (Const("thresh(", in)) {
  Branch (1999:24): [True: 0, False: 0]
2000
0
                int next_comma = FindNextChar(in, ',');
2001
0
                if (next_comma < 1) return {};
  Branch (2001:21): [True: 0, False: 0]
2002
0
                const auto k{ToIntegral<int64_t>(std::string_view(in.data(), next_comma))};
2003
0
                if (!k.has_value() || *k < 1) return {};
  Branch (2003:21): [True: 0, False: 0]
  Branch (2003:39): [True: 0, False: 0]
2004
0
                in = in.subspan(next_comma + 1);
2005
                // n = 1 here because we read the first WRAPPED_EXPR before reaching THRESH
2006
0
                to_parse.emplace_back(ParseContext::THRESH, 1, *k);
2007
0
                to_parse.emplace_back(ParseContext::WRAPPED_EXPR, -1, -1);
2008
0
                script_size += 2 + (*k > 16) + (*k > 0x7f) + (*k > 0x7fff) + (*k > 0x7fffff);
2009
0
            } else if (Const("andor(", in)) {
  Branch (2009:24): [True: 0, False: 0]
2010
0
                to_parse.emplace_back(ParseContext::ANDOR, -1, -1);
2011
0
                to_parse.emplace_back(ParseContext::CLOSE_BRACKET, -1, -1);
2012
0
                to_parse.emplace_back(ParseContext::WRAPPED_EXPR, -1, -1);
2013
0
                to_parse.emplace_back(ParseContext::COMMA, -1, -1);
2014
0
                to_parse.emplace_back(ParseContext::WRAPPED_EXPR, -1, -1);
2015
0
                to_parse.emplace_back(ParseContext::COMMA, -1, -1);
2016
0
                to_parse.emplace_back(ParseContext::WRAPPED_EXPR, -1, -1);
2017
0
                script_size += 5;
2018
0
            } else {
2019
0
                if (Const("and_n(", in)) {
  Branch (2019:21): [True: 0, False: 0]
2020
0
                    to_parse.emplace_back(ParseContext::AND_N, -1, -1);
2021
0
                    script_size += 5;
2022
0
                } else if (Const("and_b(", in)) {
  Branch (2022:28): [True: 0, False: 0]
2023
0
                    to_parse.emplace_back(ParseContext::AND_B, -1, -1);
2024
0
                    script_size += 2;
2025
0
                } else if (Const("and_v(", in)) {
  Branch (2025:28): [True: 0, False: 0]
2026
0
                    to_parse.emplace_back(ParseContext::AND_V, -1, -1);
2027
0
                    script_size += 1;
2028
0
                } else if (Const("or_b(", in)) {
  Branch (2028:28): [True: 0, False: 0]
2029
0
                    to_parse.emplace_back(ParseContext::OR_B, -1, -1);
2030
0
                    script_size += 2;
2031
0
                } else if (Const("or_c(", in)) {
  Branch (2031:28): [True: 0, False: 0]
2032
0
                    to_parse.emplace_back(ParseContext::OR_C, -1, -1);
2033
0
                    script_size += 3;
2034
0
                } else if (Const("or_d(", in)) {
  Branch (2034:28): [True: 0, False: 0]
2035
0
                    to_parse.emplace_back(ParseContext::OR_D, -1, -1);
2036
0
                    script_size += 4;
2037
0
                } else if (Const("or_i(", in)) {
  Branch (2037:28): [True: 0, False: 0]
2038
0
                    to_parse.emplace_back(ParseContext::OR_I, -1, -1);
2039
0
                    script_size += 4;
2040
0
                } else {
2041
0
                    return {};
2042
0
                }
2043
0
                to_parse.emplace_back(ParseContext::CLOSE_BRACKET, -1, -1);
2044
0
                to_parse.emplace_back(ParseContext::WRAPPED_EXPR, -1, -1);
2045
0
                to_parse.emplace_back(ParseContext::COMMA, -1, -1);
2046
0
                to_parse.emplace_back(ParseContext::WRAPPED_EXPR, -1, -1);
2047
0
            }
2048
0
            break;
2049
0
        }
2050
0
        case ParseContext::ALT: {
  Branch (2050:9): [True: 0, False: 0]
2051
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_A, Vector(std::move(constructed.back())));
2052
0
            break;
2053
0
        }
2054
0
        case ParseContext::SWAP: {
  Branch (2054:9): [True: 0, False: 0]
2055
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_S, Vector(std::move(constructed.back())));
2056
0
            break;
2057
0
        }
2058
0
        case ParseContext::CHECK: {
  Branch (2058:9): [True: 0, False: 0]
2059
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_C, Vector(std::move(constructed.back())));
2060
0
            break;
2061
0
        }
2062
0
        case ParseContext::DUP_IF: {
  Branch (2062:9): [True: 0, False: 0]
2063
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_D, Vector(std::move(constructed.back())));
2064
0
            break;
2065
0
        }
2066
0
        case ParseContext::NON_ZERO: {
  Branch (2066:9): [True: 0, False: 0]
2067
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_J, Vector(std::move(constructed.back())));
2068
0
            break;
2069
0
        }
2070
0
        case ParseContext::ZERO_NOTEQUAL: {
  Branch (2070:9): [True: 0, False: 0]
2071
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_N, Vector(std::move(constructed.back())));
2072
0
            break;
2073
0
        }
2074
0
        case ParseContext::VERIFY: {
  Branch (2074:9): [True: 0, False: 0]
2075
0
            script_size += (constructed.back()->GetType() << "x"_mst);
2076
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_V, Vector(std::move(constructed.back())));
2077
0
            break;
2078
0
        }
2079
0
        case ParseContext::WRAP_U: {
  Branch (2079:9): [True: 0, False: 0]
2080
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::OR_I, Vector(std::move(constructed.back()), MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::JUST_0)));
2081
0
            break;
2082
0
        }
2083
0
        case ParseContext::WRAP_T: {
  Branch (2083:9): [True: 0, False: 0]
2084
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::AND_V, Vector(std::move(constructed.back()), MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::JUST_1)));
2085
0
            break;
2086
0
        }
2087
0
        case ParseContext::AND_B: {
  Branch (2087:9): [True: 0, False: 0]
2088
0
            BuildBack(ctx.MsContext(), Fragment::AND_B, constructed);
2089
0
            break;
2090
0
        }
2091
0
        case ParseContext::AND_N: {
  Branch (2091:9): [True: 0, False: 0]
2092
0
            auto mid = std::move(constructed.back());
2093
0
            constructed.pop_back();
2094
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::ANDOR, Vector(std::move(constructed.back()), std::move(mid), MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::JUST_0)));
2095
0
            break;
2096
0
        }
2097
0
        case ParseContext::AND_V: {
  Branch (2097:9): [True: 0, False: 0]
2098
0
            BuildBack(ctx.MsContext(), Fragment::AND_V, constructed);
2099
0
            break;
2100
0
        }
2101
0
        case ParseContext::OR_B: {
  Branch (2101:9): [True: 0, False: 0]
2102
0
            BuildBack(ctx.MsContext(), Fragment::OR_B, constructed);
2103
0
            break;
2104
0
        }
2105
0
        case ParseContext::OR_C: {
  Branch (2105:9): [True: 0, False: 0]
2106
0
            BuildBack(ctx.MsContext(), Fragment::OR_C, constructed);
2107
0
            break;
2108
0
        }
2109
0
        case ParseContext::OR_D: {
  Branch (2109:9): [True: 0, False: 0]
2110
0
            BuildBack(ctx.MsContext(), Fragment::OR_D, constructed);
2111
0
            break;
2112
0
        }
2113
0
        case ParseContext::OR_I: {
  Branch (2113:9): [True: 0, False: 0]
2114
0
            BuildBack(ctx.MsContext(), Fragment::OR_I, constructed);
2115
0
            break;
2116
0
        }
2117
0
        case ParseContext::ANDOR: {
  Branch (2117:9): [True: 0, False: 0]
2118
0
            auto right = std::move(constructed.back());
2119
0
            constructed.pop_back();
2120
0
            auto mid = std::move(constructed.back());
2121
0
            constructed.pop_back();
2122
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::ANDOR, Vector(std::move(constructed.back()), std::move(mid), std::move(right)));
2123
0
            break;
2124
0
        }
2125
0
        case ParseContext::THRESH: {
  Branch (2125:9): [True: 0, False: 0]
2126
0
            if (in.size() < 1) return {};
  Branch (2126:17): [True: 0, False: 0]
2127
0
            if (in[0] == ',') {
  Branch (2127:17): [True: 0, False: 0]
2128
0
                in = in.subspan(1);
2129
0
                to_parse.emplace_back(ParseContext::THRESH, n+1, k);
2130
0
                to_parse.emplace_back(ParseContext::WRAPPED_EXPR, -1, -1);
2131
0
                script_size += 2;
2132
0
            } else if (in[0] == ')') {
  Branch (2132:24): [True: 0, False: 0]
2133
0
                if (k > n) return {};
  Branch (2133:21): [True: 0, False: 0]
2134
0
                in = in.subspan(1);
2135
                // Children are constructed in reverse order, so iterate from end to beginning
2136
0
                std::vector<NodeRef<Key>> subs;
2137
0
                for (int i = 0; i < n; ++i) {
  Branch (2137:33): [True: 0, False: 0]
2138
0
                    subs.push_back(std::move(constructed.back()));
2139
0
                    constructed.pop_back();
2140
0
                }
2141
0
                std::reverse(subs.begin(), subs.end());
2142
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::THRESH, std::move(subs), k));
2143
0
            } else {
2144
0
                return {};
2145
0
            }
2146
0
            break;
2147
0
        }
2148
0
        case ParseContext::COMMA: {
  Branch (2148:9): [True: 0, False: 0]
2149
0
            if (in.size() < 1 || in[0] != ',') return {};
  Branch (2149:17): [True: 0, False: 0]
  Branch (2149:34): [True: 0, False: 0]
2150
0
            in = in.subspan(1);
2151
0
            break;
2152
0
        }
2153
0
        case ParseContext::CLOSE_BRACKET: {
  Branch (2153:9): [True: 0, False: 0]
2154
0
            if (in.size() < 1 || in[0] != ')') return {};
  Branch (2154:17): [True: 0, False: 0]
  Branch (2154:34): [True: 0, False: 0]
2155
0
            in = in.subspan(1);
2156
0
            break;
2157
0
        }
2158
0
        }
2159
0
    }
2160
2161
    // Sanity checks on the produced miniscript
2162
0
    assert(constructed.size() >= 1);
  Branch (2162:5): [True: 0, False: 0]
2163
0
    CHECK_NONFATAL(constructed.size() == 1);
2164
0
    assert(constructed[0]->ScriptSize() == script_size);
  Branch (2164:5): [True: 0, False: 0]
2165
0
    if (in.size() > 0) return {};
  Branch (2165:9): [True: 0, False: 0]
2166
0
    NodeRef<Key> tl_node = std::move(constructed.front());
2167
0
    tl_node->DuplicateKeyCheck(ctx);
2168
0
    return tl_node;
2169
0
}
2170
2171
/** Decode a script into opcode/push pairs.
2172
 *
2173
 * Construct a vector with one element per opcode in the script, in reverse order.
2174
 * Each element is a pair consisting of the opcode, as well as the data pushed by
2175
 * the opcode (including OP_n), if any. OP_CHECKSIGVERIFY, OP_CHECKMULTISIGVERIFY,
2176
 * OP_NUMEQUALVERIFY and OP_EQUALVERIFY are decomposed into OP_CHECKSIG, OP_CHECKMULTISIG,
2177
 * OP_EQUAL and OP_NUMEQUAL respectively, plus OP_VERIFY.
2178
 */
2179
std::optional<std::vector<Opcode>> DecomposeScript(const CScript& script);
2180
2181
/** Determine whether the passed pair (created by DecomposeScript) is pushing a number. */
2182
std::optional<int64_t> ParseScriptNumber(const Opcode& in);
2183
2184
enum class DecodeContext {
2185
    /** A single expression of type B, K, or V. Specifically, this can't be an
2186
     * and_v or an expression of type W (a: and s: wrappers). */
2187
    SINGLE_BKV_EXPR,
2188
    /** Potentially multiple SINGLE_BKV_EXPRs as children of (potentially multiple)
2189
     * and_v expressions. Syntactic sugar for MAYBE_AND_V + SINGLE_BKV_EXPR. */
2190
    BKV_EXPR,
2191
    /** An expression of type W (a: or s: wrappers). */
2192
    W_EXPR,
2193
2194
    /** SWAP expects the next element to be OP_SWAP (inside a W-type expression that
2195
     * didn't end with FROMALTSTACK), and wraps the top of the constructed stack
2196
     * with s: */
2197
    SWAP,
2198
    /** ALT expects the next element to be TOALTSTACK (we must have already read a
2199
     * FROMALTSTACK earlier), and wraps the top of the constructed stack with a: */
2200
    ALT,
2201
    /** CHECK wraps the top constructed node with c: */
2202
    CHECK,
2203
    /** DUP_IF wraps the top constructed node with d: */
2204
    DUP_IF,
2205
    /** VERIFY wraps the top constructed node with v: */
2206
    VERIFY,
2207
    /** NON_ZERO wraps the top constructed node with j: */
2208
    NON_ZERO,
2209
    /** ZERO_NOTEQUAL wraps the top constructed node with n: */
2210
    ZERO_NOTEQUAL,
2211
2212
    /** MAYBE_AND_V will check if the next part of the script could be a valid
2213
     * miniscript sub-expression, and if so it will push AND_V and SINGLE_BKV_EXPR
2214
     * to decode it and construct the and_v node. This is recursive, to deal with
2215
     * multiple and_v nodes inside each other. */
2216
    MAYBE_AND_V,
2217
    /** AND_V will construct an and_v node from the last two constructed nodes. */
2218
    AND_V,
2219
    /** AND_B will construct an and_b node from the last two constructed nodes. */
2220
    AND_B,
2221
    /** ANDOR will construct an andor node from the last three constructed nodes. */
2222
    ANDOR,
2223
    /** OR_B will construct an or_b node from the last two constructed nodes. */
2224
    OR_B,
2225
    /** OR_C will construct an or_c node from the last two constructed nodes. */
2226
    OR_C,
2227
    /** OR_D will construct an or_d node from the last two constructed nodes. */
2228
    OR_D,
2229
2230
    /** In a thresh expression, all sub-expressions other than the first are W-type,
2231
     * and end in OP_ADD. THRESH_W will check for this OP_ADD and either push a W_EXPR
2232
     * or a SINGLE_BKV_EXPR and jump to THRESH_E accordingly. */
2233
    THRESH_W,
2234
    /** THRESH_E constructs a thresh node from the appropriate number of constructed
2235
     * children. */
2236
    THRESH_E,
2237
2238
    /** ENDIF signals that we are inside some sort of OP_IF structure, which could be
2239
     * or_d, or_c, or_i, andor, d:, or j: wrapper, depending on what follows. We read
2240
     * a BKV_EXPR and then deal with the next opcode case-by-case. */
2241
    ENDIF,
2242
    /** If, inside an ENDIF context, we find an OP_NOTIF before finding an OP_ELSE,
2243
     * we could either be in an or_d or an or_c node. We then check for IFDUP to
2244
     * distinguish these cases. */
2245
    ENDIF_NOTIF,
2246
    /** If, inside an ENDIF context, we find an OP_ELSE, then we could be in either an
2247
     * or_i or an andor node. Read the next BKV_EXPR and find either an OP_IF or an
2248
     * OP_NOTIF. */
2249
    ENDIF_ELSE,
2250
};
2251
2252
//! Parse a miniscript from a bitcoin script
2253
template<typename Key, typename Ctx, typename I>
2254
inline NodeRef<Key> DecodeScript(I& in, I last, const Ctx& ctx)
2255
0
{
2256
    // The two integers are used to hold state for thresh()
2257
0
    std::vector<std::tuple<DecodeContext, int64_t, int64_t>> to_parse;
2258
0
    std::vector<NodeRef<Key>> constructed;
2259
2260
    // This is the top level, so we assume the type is B
2261
    // (in particular, disallowing top level W expressions)
2262
0
    to_parse.emplace_back(DecodeContext::BKV_EXPR, -1, -1);
2263
2264
0
    while (!to_parse.empty()) {
  Branch (2264:12): [True: 0, False: 0]
  Branch (2264:12): [True: 0, False: 0]
  Branch (2264:12): [True: 0, False: 0]
2265
        // Exit early if the Miniscript is not going to be valid.
2266
0
        if (!constructed.empty() && !constructed.back()->IsValid()) return {};
  Branch (2266:13): [True: 0, False: 0]
  Branch (2266:37): [True: 0, False: 0]
  Branch (2266:13): [True: 0, False: 0]
  Branch (2266:37): [True: 0, False: 0]
  Branch (2266:13): [True: 0, False: 0]
  Branch (2266:37): [True: 0, False: 0]
2267
2268
        // Get the current context we are decoding within
2269
0
        auto [cur_context, n, k] = to_parse.back();
2270
0
        to_parse.pop_back();
2271
2272
0
        switch(cur_context) {
  Branch (2272:16): [True: 0, False: 0]
  Branch (2272:16): [True: 0, False: 0]
  Branch (2272:16): [True: 0, False: 0]
2273
0
        case DecodeContext::SINGLE_BKV_EXPR: {
  Branch (2273:9): [True: 0, False: 0]
  Branch (2273:9): [True: 0, False: 0]
  Branch (2273:9): [True: 0, False: 0]
2274
0
            if (in >= last) return {};
  Branch (2274:17): [True: 0, False: 0]
  Branch (2274:17): [True: 0, False: 0]
  Branch (2274:17): [True: 0, False: 0]
2275
2276
            // Constants
2277
0
            if (in[0].first == OP_1) {
  Branch (2277:17): [True: 0, False: 0]
  Branch (2277:17): [True: 0, False: 0]
  Branch (2277:17): [True: 0, False: 0]
2278
0
                ++in;
2279
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::JUST_1));
2280
0
                break;
2281
0
            }
2282
0
            if (in[0].first == OP_0) {
  Branch (2282:17): [True: 0, False: 0]
  Branch (2282:17): [True: 0, False: 0]
  Branch (2282:17): [True: 0, False: 0]
2283
0
                ++in;
2284
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::JUST_0));
2285
0
                break;
2286
0
            }
2287
            // Public keys
2288
0
            if (in[0].second.size() == 33 || in[0].second.size() == 32) {
  Branch (2288:17): [True: 0, False: 0]
  Branch (2288:46): [True: 0, False: 0]
  Branch (2288:17): [True: 0, False: 0]
  Branch (2288:46): [True: 0, False: 0]
  Branch (2288:17): [True: 0, False: 0]
  Branch (2288:46): [True: 0, False: 0]
2289
0
                auto key = ctx.FromPKBytes(in[0].second.begin(), in[0].second.end());
2290
0
                if (!key) return {};
  Branch (2290:21): [True: 0, False: 0]
  Branch (2290:21): [True: 0, False: 0]
  Branch (2290:21): [True: 0, False: 0]
2291
0
                ++in;
2292
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::PK_K, Vector(std::move(*key))));
2293
0
                break;
2294
0
            }
2295
0
            if (last - in >= 5 && in[0].first == OP_VERIFY && in[1].first == OP_EQUAL && in[3].first == OP_HASH160 && in[4].first == OP_DUP && in[2].second.size() == 20) {
  Branch (2295:17): [True: 0, False: 0]
  Branch (2295:35): [True: 0, False: 0]
  Branch (2295:63): [True: 0, False: 0]
  Branch (2295:90): [True: 0, False: 0]
  Branch (2295:119): [True: 0, False: 0]
  Branch (2295:144): [True: 0, False: 0]
  Branch (2295:17): [True: 0, False: 0]
  Branch (2295:35): [True: 0, False: 0]
  Branch (2295:63): [True: 0, False: 0]
  Branch (2295:90): [True: 0, False: 0]
  Branch (2295:119): [True: 0, False: 0]
  Branch (2295:144): [True: 0, False: 0]
  Branch (2295:17): [True: 0, False: 0]
  Branch (2295:35): [True: 0, False: 0]
  Branch (2295:63): [True: 0, False: 0]
  Branch (2295:90): [True: 0, False: 0]
  Branch (2295:119): [True: 0, False: 0]
  Branch (2295:144): [True: 0, False: 0]
2296
0
                auto key = ctx.FromPKHBytes(in[2].second.begin(), in[2].second.end());
2297
0
                if (!key) return {};
  Branch (2297:21): [True: 0, False: 0]
  Branch (2297:21): [True: 0, False: 0]
  Branch (2297:21): [True: 0, False: 0]
2298
0
                in += 5;
2299
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::PK_H, Vector(std::move(*key))));
2300
0
                break;
2301
0
            }
2302
            // Time locks
2303
0
            std::optional<int64_t> num;
2304
0
            if (last - in >= 2 && in[0].first == OP_CHECKSEQUENCEVERIFY && (num = ParseScriptNumber(in[1]))) {
  Branch (2304:17): [True: 0, False: 0]
  Branch (2304:17): [True: 0, False: 0]
  Branch (2304:35): [True: 0, False: 0]
  Branch (2304:76): [True: 0, False: 0]
  Branch (2304:17): [True: 0, False: 0]
  Branch (2304:17): [True: 0, False: 0]
  Branch (2304:35): [True: 0, False: 0]
  Branch (2304:76): [True: 0, False: 0]
  Branch (2304:17): [True: 0, False: 0]
  Branch (2304:17): [True: 0, False: 0]
  Branch (2304:35): [True: 0, False: 0]
  Branch (2304:76): [True: 0, False: 0]
2305
0
                in += 2;
2306
0
                if (*num < 1 || *num > 0x7FFFFFFFL) return {};
  Branch (2306:21): [True: 0, False: 0]
  Branch (2306:33): [True: 0, False: 0]
  Branch (2306:21): [True: 0, False: 0]
  Branch (2306:33): [True: 0, False: 0]
  Branch (2306:21): [True: 0, False: 0]
  Branch (2306:33): [True: 0, False: 0]
2307
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::OLDER, *num));
2308
0
                break;
2309
0
            }
2310
0
            if (last - in >= 2 && in[0].first == OP_CHECKLOCKTIMEVERIFY && (num = ParseScriptNumber(in[1]))) {
  Branch (2310:17): [True: 0, False: 0]
  Branch (2310:17): [True: 0, False: 0]
  Branch (2310:35): [True: 0, False: 0]
  Branch (2310:76): [True: 0, False: 0]
  Branch (2310:17): [True: 0, False: 0]
  Branch (2310:17): [True: 0, False: 0]
  Branch (2310:35): [True: 0, False: 0]
  Branch (2310:76): [True: 0, False: 0]
  Branch (2310:17): [True: 0, False: 0]
  Branch (2310:17): [True: 0, False: 0]
  Branch (2310:35): [True: 0, False: 0]
  Branch (2310:76): [True: 0, False: 0]
2311
0
                in += 2;
2312
0
                if (num < 1 || num > 0x7FFFFFFFL) return {};
  Branch (2312:21): [True: 0, False: 0]
  Branch (2312:21): [True: 0, False: 0]
  Branch (2312:32): [True: 0, False: 0]
  Branch (2312:21): [True: 0, False: 0]
  Branch (2312:21): [True: 0, False: 0]
  Branch (2312:32): [True: 0, False: 0]
  Branch (2312:21): [True: 0, False: 0]
  Branch (2312:21): [True: 0, False: 0]
  Branch (2312:32): [True: 0, False: 0]
2313
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::AFTER, *num));
2314
0
                break;
2315
0
            }
2316
            // Hashes
2317
0
            if (last - in >= 7 && in[0].first == OP_EQUAL && in[3].first == OP_VERIFY && in[4].first == OP_EQUAL && (num = ParseScriptNumber(in[5])) && num == 32 && in[6].first == OP_SIZE) {
  Branch (2317:17): [True: 0, False: 0]
  Branch (2317:17): [True: 0, False: 0]
  Branch (2317:35): [True: 0, False: 0]
  Branch (2317:62): [True: 0, False: 0]
  Branch (2317:90): [True: 0, False: 0]
  Branch (2317:117): [True: 0, False: 0]
  Branch (2317:153): [True: 0, False: 0]
  Branch (2317:166): [True: 0, False: 0]
  Branch (2317:17): [True: 0, False: 0]
  Branch (2317:17): [True: 0, False: 0]
  Branch (2317:35): [True: 0, False: 0]
  Branch (2317:62): [True: 0, False: 0]
  Branch (2317:90): [True: 0, False: 0]
  Branch (2317:117): [True: 0, False: 0]
  Branch (2317:153): [True: 0, False: 0]
  Branch (2317:166): [True: 0, False: 0]
  Branch (2317:17): [True: 0, False: 0]
  Branch (2317:17): [True: 0, False: 0]
  Branch (2317:35): [True: 0, False: 0]
  Branch (2317:62): [True: 0, False: 0]
  Branch (2317:90): [True: 0, False: 0]
  Branch (2317:117): [True: 0, False: 0]
  Branch (2317:153): [True: 0, False: 0]
  Branch (2317:166): [True: 0, False: 0]
2318
0
                if (in[2].first == OP_SHA256 && in[1].second.size() == 32) {
  Branch (2318:21): [True: 0, False: 0]
  Branch (2318:49): [True: 0, False: 0]
  Branch (2318:21): [True: 0, False: 0]
  Branch (2318:49): [True: 0, False: 0]
  Branch (2318:21): [True: 0, False: 0]
  Branch (2318:49): [True: 0, False: 0]
2319
0
                    constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::SHA256, in[1].second));
2320
0
                    in += 7;
2321
0
                    break;
2322
0
                } else if (in[2].first == OP_RIPEMD160 && in[1].second.size() == 20) {
  Branch (2322:28): [True: 0, False: 0]
  Branch (2322:59): [True: 0, False: 0]
  Branch (2322:28): [True: 0, False: 0]
  Branch (2322:59): [True: 0, False: 0]
  Branch (2322:28): [True: 0, False: 0]
  Branch (2322:59): [True: 0, False: 0]
2323
0
                    constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::RIPEMD160, in[1].second));
2324
0
                    in += 7;
2325
0
                    break;
2326
0
                } else if (in[2].first == OP_HASH256 && in[1].second.size() == 32) {
  Branch (2326:28): [True: 0, False: 0]
  Branch (2326:57): [True: 0, False: 0]
  Branch (2326:28): [True: 0, False: 0]
  Branch (2326:57): [True: 0, False: 0]
  Branch (2326:28): [True: 0, False: 0]
  Branch (2326:57): [True: 0, False: 0]
2327
0
                    constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::HASH256, in[1].second));
2328
0
                    in += 7;
2329
0
                    break;
2330
0
                } else if (in[2].first == OP_HASH160 && in[1].second.size() == 20) {
  Branch (2330:28): [True: 0, False: 0]
  Branch (2330:57): [True: 0, False: 0]
  Branch (2330:28): [True: 0, False: 0]
  Branch (2330:57): [True: 0, False: 0]
  Branch (2330:28): [True: 0, False: 0]
  Branch (2330:57): [True: 0, False: 0]
2331
0
                    constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::HASH160, in[1].second));
2332
0
                    in += 7;
2333
0
                    break;
2334
0
                }
2335
0
            }
2336
            // Multi
2337
0
            if (last - in >= 3 && in[0].first == OP_CHECKMULTISIG) {
  Branch (2337:17): [True: 0, False: 0]
  Branch (2337:35): [True: 0, False: 0]
  Branch (2337:17): [True: 0, False: 0]
  Branch (2337:35): [True: 0, False: 0]
  Branch (2337:17): [True: 0, False: 0]
  Branch (2337:35): [True: 0, False: 0]
2338
0
                if (IsTapscript(ctx.MsContext())) return {};
  Branch (2338:21): [True: 0, False: 0]
  Branch (2338:21): [True: 0, False: 0]
  Branch (2338:21): [True: 0, False: 0]
2339
0
                std::vector<Key> keys;
2340
0
                const auto n = ParseScriptNumber(in[1]);
2341
0
                if (!n || last - in < 3 + *n) return {};
  Branch (2341:21): [True: 0, False: 0]
  Branch (2341:27): [True: 0, False: 0]
  Branch (2341:21): [True: 0, False: 0]
  Branch (2341:27): [True: 0, False: 0]
  Branch (2341:21): [True: 0, False: 0]
  Branch (2341:27): [True: 0, False: 0]
2342
0
                if (*n < 1 || *n > 20) return {};
  Branch (2342:21): [True: 0, False: 0]
  Branch (2342:31): [True: 0, False: 0]
  Branch (2342:21): [True: 0, False: 0]
  Branch (2342:31): [True: 0, False: 0]
  Branch (2342:21): [True: 0, False: 0]
  Branch (2342:31): [True: 0, False: 0]
2343
0
                for (int i = 0; i < *n; ++i) {
  Branch (2343:33): [True: 0, False: 0]
  Branch (2343:33): [True: 0, False: 0]
  Branch (2343:33): [True: 0, False: 0]
2344
0
                    if (in[2 + i].second.size() != 33) return {};
  Branch (2344:25): [True: 0, False: 0]
  Branch (2344:25): [True: 0, False: 0]
  Branch (2344:25): [True: 0, False: 0]
2345
0
                    auto key = ctx.FromPKBytes(in[2 + i].second.begin(), in[2 + i].second.end());
2346
0
                    if (!key) return {};
  Branch (2346:25): [True: 0, False: 0]
  Branch (2346:25): [True: 0, False: 0]
  Branch (2346:25): [True: 0, False: 0]
2347
0
                    keys.push_back(std::move(*key));
2348
0
                }
2349
0
                const auto k = ParseScriptNumber(in[2 + *n]);
2350
0
                if (!k || *k < 1 || *k > *n) return {};
  Branch (2350:21): [True: 0, False: 0]
  Branch (2350:27): [True: 0, False: 0]
  Branch (2350:37): [True: 0, False: 0]
  Branch (2350:21): [True: 0, False: 0]
  Branch (2350:27): [True: 0, False: 0]
  Branch (2350:37): [True: 0, False: 0]
  Branch (2350:21): [True: 0, False: 0]
  Branch (2350:27): [True: 0, False: 0]
  Branch (2350:37): [True: 0, False: 0]
2351
0
                in += 3 + *n;
2352
0
                std::reverse(keys.begin(), keys.end());
2353
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::MULTI, std::move(keys), *k));
2354
0
                break;
2355
0
            }
2356
            // Tapscript's equivalent of multi
2357
0
            if (last - in >= 4 && in[0].first == OP_NUMEQUAL) {
  Branch (2357:17): [True: 0, False: 0]
  Branch (2357:35): [True: 0, False: 0]
  Branch (2357:17): [True: 0, False: 0]
  Branch (2357:35): [True: 0, False: 0]
  Branch (2357:17): [True: 0, False: 0]
  Branch (2357:35): [True: 0, False: 0]
2358
0
                if (!IsTapscript(ctx.MsContext())) return {};
  Branch (2358:21): [True: 0, False: 0]
  Branch (2358:21): [True: 0, False: 0]
  Branch (2358:21): [True: 0, False: 0]
2359
                // The necessary threshold of signatures.
2360
0
                const auto k = ParseScriptNumber(in[1]);
2361
0
                if (!k) return {};
  Branch (2361:21): [True: 0, False: 0]
  Branch (2361:21): [True: 0, False: 0]
  Branch (2361:21): [True: 0, False: 0]
2362
0
                if (*k < 1 || *k > MAX_PUBKEYS_PER_MULTI_A) return {};
  Branch (2362:21): [True: 0, False: 0]
  Branch (2362:31): [True: 0, False: 0]
  Branch (2362:21): [True: 0, False: 0]
  Branch (2362:31): [True: 0, False: 0]
  Branch (2362:21): [True: 0, False: 0]
  Branch (2362:31): [True: 0, False: 0]
2363
0
                if (last - in < 2 + *k * 2) return {};
  Branch (2363:21): [True: 0, False: 0]
  Branch (2363:21): [True: 0, False: 0]
  Branch (2363:21): [True: 0, False: 0]
2364
0
                std::vector<Key> keys;
2365
0
                keys.reserve(*k);
2366
                // Walk through the expected (pubkey, CHECKSIG[ADD]) pairs.
2367
0
                for (int pos = 2;; pos += 2) {
2368
0
                    if (last - in < pos + 2) return {};
  Branch (2368:25): [True: 0, False: 0]
  Branch (2368:25): [True: 0, False: 0]
  Branch (2368:25): [True: 0, False: 0]
2369
                    // Make sure it's indeed an x-only pubkey and a CHECKSIG[ADD], then parse the key.
2370
0
                    if (in[pos].first != OP_CHECKSIGADD && in[pos].first != OP_CHECKSIG) return {};
  Branch (2370:25): [True: 0, False: 0]
  Branch (2370:60): [True: 0, False: 0]
  Branch (2370:25): [True: 0, False: 0]
  Branch (2370:60): [True: 0, False: 0]
  Branch (2370:25): [True: 0, False: 0]
  Branch (2370:60): [True: 0, False: 0]
2371
0
                    if (in[pos + 1].second.size() != 32) return {};
  Branch (2371:25): [True: 0, False: 0]
  Branch (2371:25): [True: 0, False: 0]
  Branch (2371:25): [True: 0, False: 0]
2372
0
                    auto key = ctx.FromPKBytes(in[pos + 1].second.begin(), in[pos + 1].second.end());
2373
0
                    if (!key) return {};
  Branch (2373:25): [True: 0, False: 0]
  Branch (2373:25): [True: 0, False: 0]
  Branch (2373:25): [True: 0, False: 0]
2374
0
                    keys.push_back(std::move(*key));
2375
                    // Make sure early we don't parse an arbitrary large expression.
2376
0
                    if (keys.size() > MAX_PUBKEYS_PER_MULTI_A) return {};
  Branch (2376:25): [True: 0, False: 0]
  Branch (2376:25): [True: 0, False: 0]
  Branch (2376:25): [True: 0, False: 0]
2377
                    // OP_CHECKSIG means it was the last one to parse.
2378
0
                    if (in[pos].first == OP_CHECKSIG) break;
  Branch (2378:25): [True: 0, False: 0]
  Branch (2378:25): [True: 0, False: 0]
  Branch (2378:25): [True: 0, False: 0]
2379
0
                }
2380
0
                if (keys.size() < (size_t)*k) return {};
  Branch (2380:21): [True: 0, False: 0]
  Branch (2380:21): [True: 0, False: 0]
  Branch (2380:21): [True: 0, False: 0]
2381
0
                in += 2 + keys.size() * 2;
2382
0
                std::reverse(keys.begin(), keys.end());
2383
0
                constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::MULTI_A, std::move(keys), *k));
2384
0
                break;
2385
0
            }
2386
            /** In the following wrappers, we only need to push SINGLE_BKV_EXPR rather
2387
             * than BKV_EXPR, because and_v commutes with these wrappers. For example,
2388
             * c:and_v(X,Y) produces the same script as and_v(X,c:Y). */
2389
            // c: wrapper
2390
0
            if (in[0].first == OP_CHECKSIG) {
  Branch (2390:17): [True: 0, False: 0]
  Branch (2390:17): [True: 0, False: 0]
  Branch (2390:17): [True: 0, False: 0]
2391
0
                ++in;
2392
0
                to_parse.emplace_back(DecodeContext::CHECK, -1, -1);
2393
0
                to_parse.emplace_back(DecodeContext::SINGLE_BKV_EXPR, -1, -1);
2394
0
                break;
2395
0
            }
2396
            // v: wrapper
2397
0
            if (in[0].first == OP_VERIFY) {
  Branch (2397:17): [True: 0, False: 0]
  Branch (2397:17): [True: 0, False: 0]
  Branch (2397:17): [True: 0, False: 0]
2398
0
                ++in;
2399
0
                to_parse.emplace_back(DecodeContext::VERIFY, -1, -1);
2400
0
                to_parse.emplace_back(DecodeContext::SINGLE_BKV_EXPR, -1, -1);
2401
0
                break;
2402
0
            }
2403
            // n: wrapper
2404
0
            if (in[0].first == OP_0NOTEQUAL) {
  Branch (2404:17): [True: 0, False: 0]
  Branch (2404:17): [True: 0, False: 0]
  Branch (2404:17): [True: 0, False: 0]
2405
0
                ++in;
2406
0
                to_parse.emplace_back(DecodeContext::ZERO_NOTEQUAL, -1, -1);
2407
0
                to_parse.emplace_back(DecodeContext::SINGLE_BKV_EXPR, -1, -1);
2408
0
                break;
2409
0
            }
2410
            // Thresh
2411
0
            if (last - in >= 3 && in[0].first == OP_EQUAL && (num = ParseScriptNumber(in[1]))) {
  Branch (2411:17): [True: 0, False: 0]
  Branch (2411:17): [True: 0, False: 0]
  Branch (2411:35): [True: 0, False: 0]
  Branch (2411:62): [True: 0, False: 0]
  Branch (2411:17): [True: 0, False: 0]
  Branch (2411:17): [True: 0, False: 0]
  Branch (2411:35): [True: 0, False: 0]
  Branch (2411:62): [True: 0, False: 0]
  Branch (2411:17): [True: 0, False: 0]
  Branch (2411:17): [True: 0, False: 0]
  Branch (2411:35): [True: 0, False: 0]
  Branch (2411:62): [True: 0, False: 0]
2412
0
                if (*num < 1) return {};
  Branch (2412:21): [True: 0, False: 0]
  Branch (2412:21): [True: 0, False: 0]
  Branch (2412:21): [True: 0, False: 0]
2413
0
                in += 2;
2414
0
                to_parse.emplace_back(DecodeContext::THRESH_W, 0, *num);
2415
0
                break;
2416
0
            }
2417
            // OP_ENDIF can be WRAP_J, WRAP_D, ANDOR, OR_C, OR_D, or OR_I
2418
0
            if (in[0].first == OP_ENDIF) {
  Branch (2418:17): [True: 0, False: 0]
  Branch (2418:17): [True: 0, False: 0]
  Branch (2418:17): [True: 0, False: 0]
2419
0
                ++in;
2420
0
                to_parse.emplace_back(DecodeContext::ENDIF, -1, -1);
2421
0
                to_parse.emplace_back(DecodeContext::BKV_EXPR, -1, -1);
2422
0
                break;
2423
0
            }
2424
            /** In and_b and or_b nodes, we only look for SINGLE_BKV_EXPR, because
2425
             * or_b(and_v(X,Y),Z) has script [X] [Y] [Z] OP_BOOLOR, the same as
2426
             * and_v(X,or_b(Y,Z)). In this example, the former of these is invalid as
2427
             * miniscript, while the latter is valid. So we leave the and_v "outside"
2428
             * while decoding. */
2429
            // and_b
2430
0
            if (in[0].first == OP_BOOLAND) {
  Branch (2430:17): [True: 0, False: 0]
  Branch (2430:17): [True: 0, False: 0]
  Branch (2430:17): [True: 0, False: 0]
2431
0
                ++in;
2432
0
                to_parse.emplace_back(DecodeContext::AND_B, -1, -1);
2433
0
                to_parse.emplace_back(DecodeContext::SINGLE_BKV_EXPR, -1, -1);
2434
0
                to_parse.emplace_back(DecodeContext::W_EXPR, -1, -1);
2435
0
                break;
2436
0
            }
2437
            // or_b
2438
0
            if (in[0].first == OP_BOOLOR) {
  Branch (2438:17): [True: 0, False: 0]
  Branch (2438:17): [True: 0, False: 0]
  Branch (2438:17): [True: 0, False: 0]
2439
0
                ++in;
2440
0
                to_parse.emplace_back(DecodeContext::OR_B, -1, -1);
2441
0
                to_parse.emplace_back(DecodeContext::SINGLE_BKV_EXPR, -1, -1);
2442
0
                to_parse.emplace_back(DecodeContext::W_EXPR, -1, -1);
2443
0
                break;
2444
0
            }
2445
            // Unrecognised expression
2446
0
            return {};
2447
0
        }
2448
0
        case DecodeContext::BKV_EXPR: {
  Branch (2448:9): [True: 0, False: 0]
  Branch (2448:9): [True: 0, False: 0]
  Branch (2448:9): [True: 0, False: 0]
2449
0
            to_parse.emplace_back(DecodeContext::MAYBE_AND_V, -1, -1);
2450
0
            to_parse.emplace_back(DecodeContext::SINGLE_BKV_EXPR, -1, -1);
2451
0
            break;
2452
0
        }
2453
0
        case DecodeContext::W_EXPR: {
  Branch (2453:9): [True: 0, False: 0]
  Branch (2453:9): [True: 0, False: 0]
  Branch (2453:9): [True: 0, False: 0]
2454
            // a: wrapper
2455
0
            if (in >= last) return {};
  Branch (2455:17): [True: 0, False: 0]
  Branch (2455:17): [True: 0, False: 0]
  Branch (2455:17): [True: 0, False: 0]
2456
0
            if (in[0].first == OP_FROMALTSTACK) {
  Branch (2456:17): [True: 0, False: 0]
  Branch (2456:17): [True: 0, False: 0]
  Branch (2456:17): [True: 0, False: 0]
2457
0
                ++in;
2458
0
                to_parse.emplace_back(DecodeContext::ALT, -1, -1);
2459
0
            } else {
2460
0
                to_parse.emplace_back(DecodeContext::SWAP, -1, -1);
2461
0
            }
2462
0
            to_parse.emplace_back(DecodeContext::BKV_EXPR, -1, -1);
2463
0
            break;
2464
0
        }
2465
0
        case DecodeContext::MAYBE_AND_V: {
  Branch (2465:9): [True: 0, False: 0]
  Branch (2465:9): [True: 0, False: 0]
  Branch (2465:9): [True: 0, False: 0]
2466
            // If we reach a potential AND_V top-level, check if the next part of the script could be another AND_V child
2467
            // These op-codes cannot end any well-formed miniscript so cannot be used in an and_v node.
2468
0
            if (in < last && in[0].first != OP_IF && in[0].first != OP_ELSE && in[0].first != OP_NOTIF && in[0].first != OP_TOALTSTACK && in[0].first != OP_SWAP) {
  Branch (2468:17): [True: 0, False: 0]
  Branch (2468:30): [True: 0, False: 0]
  Branch (2468:54): [True: 0, False: 0]
  Branch (2468:80): [True: 0, False: 0]
  Branch (2468:107): [True: 0, False: 0]
  Branch (2468:139): [True: 0, False: 0]
  Branch (2468:17): [True: 0, False: 0]
  Branch (2468:30): [True: 0, False: 0]
  Branch (2468:54): [True: 0, False: 0]
  Branch (2468:80): [True: 0, False: 0]
  Branch (2468:107): [True: 0, False: 0]
  Branch (2468:139): [True: 0, False: 0]
  Branch (2468:17): [True: 0, False: 0]
  Branch (2468:30): [True: 0, False: 0]
  Branch (2468:54): [True: 0, False: 0]
  Branch (2468:80): [True: 0, False: 0]
  Branch (2468:107): [True: 0, False: 0]
  Branch (2468:139): [True: 0, False: 0]
2469
0
                to_parse.emplace_back(DecodeContext::AND_V, -1, -1);
2470
                // BKV_EXPR can contain more AND_V nodes
2471
0
                to_parse.emplace_back(DecodeContext::BKV_EXPR, -1, -1);
2472
0
            }
2473
0
            break;
2474
0
        }
2475
0
        case DecodeContext::SWAP: {
  Branch (2475:9): [True: 0, False: 0]
  Branch (2475:9): [True: 0, False: 0]
  Branch (2475:9): [True: 0, False: 0]
2476
0
            if (in >= last || in[0].first != OP_SWAP || constructed.empty()) return {};
  Branch (2476:17): [True: 0, False: 0]
  Branch (2476:31): [True: 0, False: 0]
  Branch (2476:57): [True: 0, False: 0]
  Branch (2476:17): [True: 0, False: 0]
  Branch (2476:31): [True: 0, False: 0]
  Branch (2476:57): [True: 0, False: 0]
  Branch (2476:17): [True: 0, False: 0]
  Branch (2476:31): [True: 0, False: 0]
  Branch (2476:57): [True: 0, False: 0]
2477
0
            ++in;
2478
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_S, Vector(std::move(constructed.back())));
2479
0
            break;
2480
0
        }
2481
0
        case DecodeContext::ALT: {
  Branch (2481:9): [True: 0, False: 0]
  Branch (2481:9): [True: 0, False: 0]
  Branch (2481:9): [True: 0, False: 0]
2482
0
            if (in >= last || in[0].first != OP_TOALTSTACK || constructed.empty()) return {};
  Branch (2482:17): [True: 0, False: 0]
  Branch (2482:31): [True: 0, False: 0]
  Branch (2482:63): [True: 0, False: 0]
  Branch (2482:17): [True: 0, False: 0]
  Branch (2482:31): [True: 0, False: 0]
  Branch (2482:63): [True: 0, False: 0]
  Branch (2482:17): [True: 0, False: 0]
  Branch (2482:31): [True: 0, False: 0]
  Branch (2482:63): [True: 0, False: 0]
2483
0
            ++in;
2484
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_A, Vector(std::move(constructed.back())));
2485
0
            break;
2486
0
        }
2487
0
        case DecodeContext::CHECK: {
  Branch (2487:9): [True: 0, False: 0]
  Branch (2487:9): [True: 0, False: 0]
  Branch (2487:9): [True: 0, False: 0]
2488
0
            if (constructed.empty()) return {};
  Branch (2488:17): [True: 0, False: 0]
  Branch (2488:17): [True: 0, False: 0]
  Branch (2488:17): [True: 0, False: 0]
2489
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_C, Vector(std::move(constructed.back())));
2490
0
            break;
2491
0
        }
2492
0
        case DecodeContext::DUP_IF: {
  Branch (2492:9): [True: 0, False: 0]
  Branch (2492:9): [True: 0, False: 0]
  Branch (2492:9): [True: 0, False: 0]
2493
0
            if (constructed.empty()) return {};
  Branch (2493:17): [True: 0, False: 0]
  Branch (2493:17): [True: 0, False: 0]
  Branch (2493:17): [True: 0, False: 0]
2494
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_D, Vector(std::move(constructed.back())));
2495
0
            break;
2496
0
        }
2497
0
        case DecodeContext::VERIFY: {
  Branch (2497:9): [True: 0, False: 0]
  Branch (2497:9): [True: 0, False: 0]
  Branch (2497:9): [True: 0, False: 0]
2498
0
            if (constructed.empty()) return {};
  Branch (2498:17): [True: 0, False: 0]
  Branch (2498:17): [True: 0, False: 0]
  Branch (2498:17): [True: 0, False: 0]
2499
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_V, Vector(std::move(constructed.back())));
2500
0
            break;
2501
0
        }
2502
0
        case DecodeContext::NON_ZERO: {
  Branch (2502:9): [True: 0, False: 0]
  Branch (2502:9): [True: 0, False: 0]
  Branch (2502:9): [True: 0, False: 0]
2503
0
            if (constructed.empty()) return {};
  Branch (2503:17): [True: 0, False: 0]
  Branch (2503:17): [True: 0, False: 0]
  Branch (2503:17): [True: 0, False: 0]
2504
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_J, Vector(std::move(constructed.back())));
2505
0
            break;
2506
0
        }
2507
0
        case DecodeContext::ZERO_NOTEQUAL: {
  Branch (2507:9): [True: 0, False: 0]
  Branch (2507:9): [True: 0, False: 0]
  Branch (2507:9): [True: 0, False: 0]
2508
0
            if (constructed.empty()) return {};
  Branch (2508:17): [True: 0, False: 0]
  Branch (2508:17): [True: 0, False: 0]
  Branch (2508:17): [True: 0, False: 0]
2509
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::WRAP_N, Vector(std::move(constructed.back())));
2510
0
            break;
2511
0
        }
2512
0
        case DecodeContext::AND_V: {
  Branch (2512:9): [True: 0, False: 0]
  Branch (2512:9): [True: 0, False: 0]
  Branch (2512:9): [True: 0, False: 0]
2513
0
            if (constructed.size() < 2) return {};
  Branch (2513:17): [True: 0, False: 0]
  Branch (2513:17): [True: 0, False: 0]
  Branch (2513:17): [True: 0, False: 0]
2514
0
            BuildBack(ctx.MsContext(), Fragment::AND_V, constructed, /*reverse=*/true);
2515
0
            break;
2516
0
        }
2517
0
        case DecodeContext::AND_B: {
  Branch (2517:9): [True: 0, False: 0]
  Branch (2517:9): [True: 0, False: 0]
  Branch (2517:9): [True: 0, False: 0]
2518
0
            if (constructed.size() < 2) return {};
  Branch (2518:17): [True: 0, False: 0]
  Branch (2518:17): [True: 0, False: 0]
  Branch (2518:17): [True: 0, False: 0]
2519
0
            BuildBack(ctx.MsContext(), Fragment::AND_B, constructed, /*reverse=*/true);
2520
0
            break;
2521
0
        }
2522
0
        case DecodeContext::OR_B: {
  Branch (2522:9): [True: 0, False: 0]
  Branch (2522:9): [True: 0, False: 0]
  Branch (2522:9): [True: 0, False: 0]
2523
0
            if (constructed.size() < 2) return {};
  Branch (2523:17): [True: 0, False: 0]
  Branch (2523:17): [True: 0, False: 0]
  Branch (2523:17): [True: 0, False: 0]
2524
0
            BuildBack(ctx.MsContext(), Fragment::OR_B, constructed, /*reverse=*/true);
2525
0
            break;
2526
0
        }
2527
0
        case DecodeContext::OR_C: {
  Branch (2527:9): [True: 0, False: 0]
  Branch (2527:9): [True: 0, False: 0]
  Branch (2527:9): [True: 0, False: 0]
2528
0
            if (constructed.size() < 2) return {};
  Branch (2528:17): [True: 0, False: 0]
  Branch (2528:17): [True: 0, False: 0]
  Branch (2528:17): [True: 0, False: 0]
2529
0
            BuildBack(ctx.MsContext(), Fragment::OR_C, constructed, /*reverse=*/true);
2530
0
            break;
2531
0
        }
2532
0
        case DecodeContext::OR_D: {
  Branch (2532:9): [True: 0, False: 0]
  Branch (2532:9): [True: 0, False: 0]
  Branch (2532:9): [True: 0, False: 0]
2533
0
            if (constructed.size() < 2) return {};
  Branch (2533:17): [True: 0, False: 0]
  Branch (2533:17): [True: 0, False: 0]
  Branch (2533:17): [True: 0, False: 0]
2534
0
            BuildBack(ctx.MsContext(), Fragment::OR_D, constructed, /*reverse=*/true);
2535
0
            break;
2536
0
        }
2537
0
        case DecodeContext::ANDOR: {
  Branch (2537:9): [True: 0, False: 0]
  Branch (2537:9): [True: 0, False: 0]
  Branch (2537:9): [True: 0, False: 0]
2538
0
            if (constructed.size() < 3) return {};
  Branch (2538:17): [True: 0, False: 0]
  Branch (2538:17): [True: 0, False: 0]
  Branch (2538:17): [True: 0, False: 0]
2539
0
            NodeRef<Key> left = std::move(constructed.back());
2540
0
            constructed.pop_back();
2541
0
            NodeRef<Key> right = std::move(constructed.back());
2542
0
            constructed.pop_back();
2543
0
            NodeRef<Key> mid = std::move(constructed.back());
2544
0
            constructed.back() = MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::ANDOR, Vector(std::move(left), std::move(mid), std::move(right)));
2545
0
            break;
2546
0
        }
2547
0
        case DecodeContext::THRESH_W: {
  Branch (2547:9): [True: 0, False: 0]
  Branch (2547:9): [True: 0, False: 0]
  Branch (2547:9): [True: 0, False: 0]
2548
0
            if (in >= last) return {};
  Branch (2548:17): [True: 0, False: 0]
  Branch (2548:17): [True: 0, False: 0]
  Branch (2548:17): [True: 0, False: 0]
2549
0
            if (in[0].first == OP_ADD) {
  Branch (2549:17): [True: 0, False: 0]
  Branch (2549:17): [True: 0, False: 0]
  Branch (2549:17): [True: 0, False: 0]
2550
0
                ++in;
2551
0
                to_parse.emplace_back(DecodeContext::THRESH_W, n+1, k);
2552
0
                to_parse.emplace_back(DecodeContext::W_EXPR, -1, -1);
2553
0
            } else {
2554
0
                to_parse.emplace_back(DecodeContext::THRESH_E, n+1, k);
2555
                // All children of thresh have type modifier d, so cannot be and_v
2556
0
                to_parse.emplace_back(DecodeContext::SINGLE_BKV_EXPR, -1, -1);
2557
0
            }
2558
0
            break;
2559
0
        }
2560
0
        case DecodeContext::THRESH_E: {
  Branch (2560:9): [True: 0, False: 0]
  Branch (2560:9): [True: 0, False: 0]
  Branch (2560:9): [True: 0, False: 0]
2561
0
            if (k < 1 || k > n || constructed.size() < static_cast<size_t>(n)) return {};
  Branch (2561:17): [True: 0, False: 0]
  Branch (2561:26): [True: 0, False: 0]
  Branch (2561:35): [True: 0, False: 0]
  Branch (2561:17): [True: 0, False: 0]
  Branch (2561:26): [True: 0, False: 0]
  Branch (2561:35): [True: 0, False: 0]
  Branch (2561:17): [True: 0, False: 0]
  Branch (2561:26): [True: 0, False: 0]
  Branch (2561:35): [True: 0, False: 0]
2562
0
            std::vector<NodeRef<Key>> subs;
2563
0
            for (int i = 0; i < n; ++i) {
  Branch (2563:29): [True: 0, False: 0]
  Branch (2563:29): [True: 0, False: 0]
  Branch (2563:29): [True: 0, False: 0]
2564
0
                NodeRef<Key> sub = std::move(constructed.back());
2565
0
                constructed.pop_back();
2566
0
                subs.push_back(std::move(sub));
2567
0
            }
2568
0
            constructed.push_back(MakeNodeRef<Key>(internal::NoDupCheck{}, ctx.MsContext(), Fragment::THRESH, std::move(subs), k));
2569
0
            break;
2570
0
        }
2571
0
        case DecodeContext::ENDIF: {
  Branch (2571:9): [True: 0, False: 0]
  Branch (2571:9): [True: 0, False: 0]
  Branch (2571:9): [True: 0, False: 0]
2572
0
            if (in >= last) return {};
  Branch (2572:17): [True: 0, False: 0]
  Branch (2572:17): [True: 0, False: 0]
  Branch (2572:17): [True: 0, False: 0]
2573
2574
            // could be andor or or_i
2575
0
            if (in[0].first == OP_ELSE) {
  Branch (2575:17): [True: 0, False: 0]
  Branch (2575:17): [True: 0, False: 0]
  Branch (2575:17): [True: 0, False: 0]
2576
0
                ++in;
2577
0
                to_parse.emplace_back(DecodeContext::ENDIF_ELSE, -1, -1);
2578
0
                to_parse.emplace_back(DecodeContext::BKV_EXPR, -1, -1);
2579
0
            }
2580
            // could be j: or d: wrapper
2581
0
            else if (in[0].first == OP_IF) {
  Branch (2581:22): [True: 0, False: 0]
  Branch (2581:22): [True: 0, False: 0]
  Branch (2581:22): [True: 0, False: 0]
2582
0
                if (last - in >= 2 && in[1].first == OP_DUP) {
  Branch (2582:21): [True: 0, False: 0]
  Branch (2582:39): [True: 0, False: 0]
  Branch (2582:21): [True: 0, False: 0]
  Branch (2582:39): [True: 0, False: 0]
  Branch (2582:21): [True: 0, False: 0]
  Branch (2582:39): [True: 0, False: 0]
2583
0
                    in += 2;
2584
0
                    to_parse.emplace_back(DecodeContext::DUP_IF, -1, -1);
2585
0
                } else if (last - in >= 3 && in[1].first == OP_0NOTEQUAL && in[2].first == OP_SIZE) {
  Branch (2585:28): [True: 0, False: 0]
  Branch (2585:46): [True: 0, False: 0]
  Branch (2585:77): [True: 0, False: 0]
  Branch (2585:28): [True: 0, False: 0]
  Branch (2585:46): [True: 0, False: 0]
  Branch (2585:77): [True: 0, False: 0]
  Branch (2585:28): [True: 0, False: 0]
  Branch (2585:46): [True: 0, False: 0]
  Branch (2585:77): [True: 0, False: 0]
2586
0
                    in += 3;
2587
0
                    to_parse.emplace_back(DecodeContext::NON_ZERO, -1, -1);
2588
0
                }
2589
0
                else {
2590
0
                    return {};
2591
0
                }
2592
            // could be or_c or or_d
2593
0
            } else if (in[0].first == OP_NOTIF) {
  Branch (2593:24): [True: 0, False: 0]
  Branch (2593:24): [True: 0, False: 0]
  Branch (2593:24): [True: 0, False: 0]
2594
0
                ++in;
2595
0
                to_parse.emplace_back(DecodeContext::ENDIF_NOTIF, -1, -1);
2596
0
            }
2597
0
            else {
2598
0
                return {};
2599
0
            }
2600
0
            break;
2601
0
        }
2602
0
        case DecodeContext::ENDIF_NOTIF: {
  Branch (2602:9): [True: 0, False: 0]
  Branch (2602:9): [True: 0, False: 0]
  Branch (2602:9): [True: 0, False: 0]
2603
0
            if (in >= last) return {};
  Branch (2603:17): [True: 0, False: 0]
  Branch (2603:17): [True: 0, False: 0]
  Branch (2603:17): [True: 0, False: 0]
2604
0
            if (in[0].first == OP_IFDUP) {
  Branch (2604:17): [True: 0, False: 0]
  Branch (2604:17): [True: 0, False: 0]
  Branch (2604:17): [True: 0, False: 0]
2605
0
                ++in;
2606
0
                to_parse.emplace_back(DecodeContext::OR_D, -1, -1);
2607
0
            } else {
2608
0
                to_parse.emplace_back(DecodeContext::OR_C, -1, -1);
2609
0
            }
2610
            // or_c and or_d both require X to have type modifier d so, can't contain and_v
2611
0
            to_parse.emplace_back(DecodeContext::SINGLE_BKV_EXPR, -1, -1);
2612
0
            break;
2613
0
        }
2614
0
        case DecodeContext::ENDIF_ELSE: {
  Branch (2614:9): [True: 0, False: 0]
  Branch (2614:9): [True: 0, False: 0]
  Branch (2614:9): [True: 0, False: 0]
2615
0
            if (in >= last) return {};
  Branch (2615:17): [True: 0, False: 0]
  Branch (2615:17): [True: 0, False: 0]
  Branch (2615:17): [True: 0, False: 0]
2616
0
            if (in[0].first == OP_IF) {
  Branch (2616:17): [True: 0, False: 0]
  Branch (2616:17): [True: 0, False: 0]
  Branch (2616:17): [True: 0, False: 0]
2617
0
                ++in;
2618
0
                BuildBack(ctx.MsContext(), Fragment::OR_I, constructed, /*reverse=*/true);
2619
0
            } else if (in[0].first == OP_NOTIF) {
  Branch (2619:24): [True: 0, False: 0]
  Branch (2619:24): [True: 0, False: 0]
  Branch (2619:24): [True: 0, False: 0]
2620
0
                ++in;
2621
0
                to_parse.emplace_back(DecodeContext::ANDOR, -1, -1);
2622
                // andor requires X to have type modifier d, so it can't be and_v
2623
0
                to_parse.emplace_back(DecodeContext::SINGLE_BKV_EXPR, -1, -1);
2624
0
            } else {
2625
0
                return {};
2626
0
            }
2627
0
            break;
2628
0
        }
2629
0
        }
2630
0
    }
2631
0
    if (constructed.size() != 1) return {};
  Branch (2631:9): [True: 0, False: 0]
  Branch (2631:9): [True: 0, False: 0]
  Branch (2631:9): [True: 0, False: 0]
2632
0
    NodeRef<Key> tl_node = std::move(constructed.front());
2633
0
    tl_node->DuplicateKeyCheck(ctx);
2634
    // Note that due to how ComputeType works (only assign the type to the node if the
2635
    // subs' types are valid) this would fail if any node of tree is badly typed.
2636
0
    if (!tl_node->IsValidTopLevel()) return {};
  Branch (2636:9): [True: 0, False: 0]
  Branch (2636:9): [True: 0, False: 0]
  Branch (2636:9): [True: 0, False: 0]
2637
0
    return tl_node;
2638
0
}
Unexecuted instantiation: descriptor.cpp:std::unique_ptr<miniscript::Node<unsigned int> const, std::default_delete<miniscript::Node<unsigned int> const> > miniscript::internal::DecodeScript<unsigned int, (anonymous namespace)::KeyParser, __gnu_cxx::__normal_iterator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >*, std::vector<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >, std::allocator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > > > > > >(__gnu_cxx::__normal_iterator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >*, std::vector<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >, std::allocator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > > > > >&, __gnu_cxx::__normal_iterator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >*, std::vector<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >, std::allocator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > > > > >, (anonymous namespace)::KeyParser const&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<XOnlyPubKey> const, std::default_delete<miniscript::Node<XOnlyPubKey> const> > miniscript::internal::DecodeScript<XOnlyPubKey, TapSatisfier, __gnu_cxx::__normal_iterator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >*, std::vector<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >, std::allocator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > > > > > >(__gnu_cxx::__normal_iterator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >*, std::vector<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >, std::allocator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > > > > >&, __gnu_cxx::__normal_iterator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >*, std::vector<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >, std::allocator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > > > > >, TapSatisfier const&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<CPubKey> const, std::default_delete<miniscript::Node<CPubKey> const> > miniscript::internal::DecodeScript<CPubKey, WshSatisfier, __gnu_cxx::__normal_iterator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >*, std::vector<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >, std::allocator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > > > > > >(__gnu_cxx::__normal_iterator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >*, std::vector<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >, std::allocator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > > > > >&, __gnu_cxx::__normal_iterator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >*, std::vector<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > >, std::allocator<std::pair<opcodetype, std::vector<unsigned char, std::allocator<unsigned char> > > > > >, WshSatisfier const&)
2639
2640
} // namespace internal
2641
2642
template<typename Ctx>
2643
0
inline NodeRef<typename Ctx::Key> FromString(const std::string& str, const Ctx& ctx) {
2644
0
    return internal::Parse<typename Ctx::Key>(str, ctx);
2645
0
}
2646
2647
template<typename Ctx>
2648
0
inline NodeRef<typename Ctx::Key> FromScript(const CScript& script, const Ctx& ctx) {
2649
0
    using namespace internal;
2650
    // A too large Script is necessarily invalid, don't bother parsing it.
2651
0
    if (script.size() > MaxScriptSize(ctx.MsContext())) return {};
  Branch (2651:9): [True: 0, False: 0]
  Branch (2651:9): [True: 0, False: 0]
  Branch (2651:9): [True: 0, False: 0]
2652
0
    auto decomposed = DecomposeScript(script);
2653
0
    if (!decomposed) return {};
  Branch (2653:9): [True: 0, False: 0]
  Branch (2653:9): [True: 0, False: 0]
  Branch (2653:9): [True: 0, False: 0]
2654
0
    auto it = decomposed->begin();
2655
0
    auto ret = DecodeScript<typename Ctx::Key>(it, decomposed->end(), ctx);
2656
0
    if (!ret) return {};
  Branch (2656:9): [True: 0, False: 0]
  Branch (2656:9): [True: 0, False: 0]
  Branch (2656:9): [True: 0, False: 0]
2657
0
    if (it != decomposed->end()) return {};
  Branch (2657:9): [True: 0, False: 0]
  Branch (2657:9): [True: 0, False: 0]
  Branch (2657:9): [True: 0, False: 0]
2658
0
    return ret;
2659
0
}
Unexecuted instantiation: descriptor.cpp:std::unique_ptr<miniscript::Node<(anonymous namespace)::KeyParser::Key> const, std::default_delete<miniscript::Node<(anonymous namespace)::KeyParser::Key> const> > miniscript::FromScript<(anonymous namespace)::KeyParser>(CScript const&, (anonymous namespace)::KeyParser const&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<TapSatisfier::Key> const, std::default_delete<miniscript::Node<TapSatisfier::Key> const> > miniscript::FromScript<TapSatisfier>(CScript const&, TapSatisfier const&)
Unexecuted instantiation: std::unique_ptr<miniscript::Node<WshSatisfier::Key> const, std::default_delete<miniscript::Node<WshSatisfier::Key> const> > miniscript::FromScript<WshSatisfier>(CScript const&, WshSatisfier const&)
2660
2661
} // namespace miniscript
2662
2663
#endif // BITCOIN_SCRIPT_MINISCRIPT_H