aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Poinsot <darosior@protonmail.com>2021-12-06 13:32:09 +0100
committerAntoine Poinsot <darosior@protonmail.com>2022-04-28 16:44:41 +0200
commita0f064dc1474a048e236bfff12f4def3aa11daf3 (patch)
tree7e03d83591547bbd9d1c67a3144c98ab6cdbaad6
parented45ee3882e69266d550b56ff69388e071f0ad1b (diff)
miniscript: introduce a CheckTimeLocksMix helper
This helps to have finer-grained descriptor parsing errors.
-rw-r--r--src/script/miniscript.h5
1 files changed, 4 insertions, 1 deletions
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(); }