mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-01 03:01:05 +00:00
refactor(miniscript): Remove Node::subs mutability
This commit is contained in:
parent
c6f798b222
commit
e55b23c170
@ -2566,7 +2566,7 @@ std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index
|
||||
}
|
||||
if (!node->IsSane() || node->IsNotSatisfiable()) {
|
||||
// Try to find the first insane sub for better error reporting.
|
||||
auto insane_node = node.get();
|
||||
const decltype(node)::element_type* insane_node = node.get();
|
||||
if (const auto sub = node->FindInsaneSub()) insane_node = sub;
|
||||
error = *insane_node->ToString(parser);
|
||||
if (!insane_node->IsValid()) {
|
||||
|
||||
@ -191,11 +191,11 @@ inline consteval Type operator""_mst(const char* c, size_t l)
|
||||
using Opcode = std::pair<opcodetype, std::vector<unsigned char>>;
|
||||
|
||||
template<typename Key> class Node;
|
||||
template<typename Key> using NodeRef = std::unique_ptr<const Node<Key>>;
|
||||
template<typename Key> using NodeRef = std::unique_ptr<Node<Key>>;
|
||||
|
||||
//! Construct a miniscript node as a unique_ptr.
|
||||
template<typename Key, typename... Args>
|
||||
NodeRef<Key> MakeNodeRef(Args&&... args) { return std::make_unique<const Node<Key>>(std::forward<Args>(args)...); }
|
||||
NodeRef<Key> MakeNodeRef(Args&&... args) { return std::make_unique<Node<Key>>(std::forward<Args>(args)...); }
|
||||
|
||||
//! Unordered traversal of a miniscript node tree.
|
||||
template <typename Key, std::invocable<const Node<Key>&> Fn>
|
||||
@ -545,7 +545,7 @@ class Node
|
||||
//! The data bytes in this expression (only for HASH160/HASH256/SHA256/RIPEMD160).
|
||||
std::vector<unsigned char> data;
|
||||
//! Subexpressions (for WRAP_*/AND_*/OR_*/ANDOR/THRESH)
|
||||
mutable std::vector<NodeRef<Key>> subs;
|
||||
std::vector<NodeRef<Key>> subs;
|
||||
//! The Script context for this node. Either P2WSH or Tapscript.
|
||||
MiniscriptContext m_script_ctx;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user