From a0f064dc1474a048e236bfff12f4def3aa11daf3 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Mon, 6 Dec 2021 13:32:09 +0100 Subject: [PATCH] miniscript: introduce a CheckTimeLocksMix helper This helps to have finer-grained descriptor parsing errors. --- src/script/miniscript.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/script/miniscript.h b/src/script/miniscript.h index 20aeb3c01b..54eda4b286 100644 --- a/src/script/miniscript.h +++ b/src/script/miniscript.h @@ -776,8 +776,11 @@ public: //! Check whether this script always needs a signature. bool NeedsSignature() const { return GetType() << "s"_mst; } + //! 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() && GetType() << "mk"_mst && CheckOpsLimit() && CheckStackSize(); } + bool IsSane() const { return IsValid() && IsNonMalleable() && CheckTimeLocksMix() && CheckOpsLimit() && CheckStackSize(); } //! Check whether this node is safe as a script on its own. bool IsSaneTopLevel() const { return IsValidTopLevel() && IsSane() && NeedsSignature(); }