Skip to content

Commit

Permalink
miniscript: IsSafe() implies IsValid(), separate IsSafe() and IsSafeT…
Browse files Browse the repository at this point in the history
…opLevel()

Signed-off-by: Antoine Poinsot <[email protected]>
  • Loading branch information
darosior committed Sep 29, 2021
1 parent d37485f commit fa2fa68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bitcoin/script/miniscript.h
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,10 @@ struct Node {
bool NeedsSignature() const { return GetType() << "s"_mst; }

//! Do all sanity checks.
bool IsSafeTopLevel() const { return GetType() << "Bmsk"_mst && CheckOpsLimit() && CheckStackSize(); }
bool IsSafe() const { return GetType() << "msk"_mst && CheckOpsLimit() && CheckStackSize() && IsValid(); }

//! Check whether this node is safe as a script on its own.
bool IsSafeTopLevel() const { return GetType() << "B"_mst && IsSafe() && IsValidTopLevel(); }

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

0 comments on commit fa2fa68

Please sign in to comment.