From 5cea85f12cba5dcfe3a298eddfa711f582adffac Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Tue, 12 Apr 2022 19:26:12 +0200 Subject: miniscript: split ValidSatisfactions from IsSane This makes IsSane clearer. It is useful to differentiate between 'potential non-malleable satisfactions are valid' and 'such satisfactions exist' for testing. Co-authored-by: Pieter Wuille --- src/script/miniscript.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/script/miniscript.h b/src/script/miniscript.h index 54eda4b286..4774308920 100644 --- a/src/script/miniscript.h +++ b/src/script/miniscript.h @@ -779,8 +779,11 @@ public: //! Check whether there is no satisfaction path that contains both timelocks and heightlocks bool CheckTimeLocksMix() const { return GetType() << "k"_mst; } - //! Do all sanity checks. - bool IsSane() const { return IsValid() && IsNonMalleable() && CheckTimeLocksMix() && CheckOpsLimit() && CheckStackSize(); } + //! Whether successful non-malleable satisfactions are guaranteed to be valid. + bool ValidSatisfactions() const { return IsValid() && CheckOpsLimit() && CheckStackSize(); } + + //! Whether the apparent policy of this node matches its script semantics. + bool IsSane() const { return ValidSatisfactions() && IsNonMalleable() && CheckTimeLocksMix(); } //! Check whether this node is safe as a script on its own. bool IsSaneTopLevel() const { return IsValidTopLevel() && IsSane() && NeedsSignature(); } -- cgit v1.2.3