From e55b23c170eb1a80a71e2de8b48cf8a0aebda843 Mon Sep 17 00:00:00 2001 From: Hodlinator <172445034+hodlinator@users.noreply.github.com> Date: Tue, 24 Jun 2025 09:46:52 +0200 Subject: [PATCH] refactor(miniscript): Remove Node::subs mutability --- src/script/descriptor.cpp | 2 +- src/script/miniscript.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index 390e7345515..8769a262f58 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -2566,7 +2566,7 @@ std::vector> 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()) { diff --git a/src/script/miniscript.h b/src/script/miniscript.h index 1c5f7a8c0f4..92925396469 100644 --- a/src/script/miniscript.h +++ b/src/script/miniscript.h @@ -191,11 +191,11 @@ inline consteval Type operator""_mst(const char* c, size_t l) using Opcode = std::pair>; template class Node; -template using NodeRef = std::unique_ptr>; +template using NodeRef = std::unique_ptr>; //! Construct a miniscript node as a unique_ptr. template -NodeRef MakeNodeRef(Args&&... args) { return std::make_unique>(std::forward(args)...); } +NodeRef MakeNodeRef(Args&&... args) { return std::make_unique>(std::forward(args)...); } //! Unordered traversal of a miniscript node tree. template &> Fn> @@ -545,7 +545,7 @@ class Node //! The data bytes in this expression (only for HASH160/HASH256/SHA256/RIPEMD160). std::vector data; //! Subexpressions (for WRAP_*/AND_*/OR_*/ANDOR/THRESH) - mutable std::vector> subs; + std::vector> subs; //! The Script context for this node. Either P2WSH or Tapscript. MiniscriptContext m_script_ctx;