Skip to content

Commit fa2fa68

Browse files
committed
miniscript: IsSafe() implies IsValid(), separate IsSafe() and IsSafeTopLevel()
Signed-off-by: Antoine Poinsot <[email protected]>
1 parent d37485f commit fa2fa68

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bitcoin/script/miniscript.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,10 @@ struct Node {
784784
bool NeedsSignature() const { return GetType() << "s"_mst; }
785785

786786
//! Do all sanity checks.
787-
bool IsSafeTopLevel() const { return GetType() << "Bmsk"_mst && CheckOpsLimit() && CheckStackSize(); }
787+
bool IsSafe() const { return GetType() << "msk"_mst && CheckOpsLimit() && CheckStackSize() && IsValid(); }
788+
789+
//! Check whether this node is safe as a script on its own.
790+
bool IsSafeTopLevel() const { return GetType() << "B"_mst && IsSafe() && IsValidTopLevel(); }
788791

789792
//! Construct the script for this miniscript (including subexpressions).
790793
template<typename Ctx>

0 commit comments

Comments
 (0)