miniscript: introduce a CheckTimeLocksMix helper

This helps to have finer-grained descriptor parsing errors.
This commit is contained in:
Antoine Poinsot 2021-12-06 13:32:09 +01:00
parent ed45ee3882
commit a0f064dc14
No known key found for this signature in database
GPG key ID: E13FC145CD3F4304

View file

@ -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(); }