aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorAntoine Poinsot <darosior@protonmail.com>2022-04-12 19:26:12 +0200
committerAntoine Poinsot <darosior@protonmail.com>2022-04-28 16:44:41 +0200
commit5cea85f12cba5dcfe3a298eddfa711f582adffac (patch)
tree9257e8e45d8a6b7768ab5d48478eda3e349d7d79 /src/script
parenta0f064dc1474a048e236bfff12f4def3aa11daf3 (diff)
downloadbitcoin-5cea85f12cba5dcfe3a298eddfa711f582adffac.tar.xz
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 <pieter.wuille@gmail.com>
Diffstat (limited to 'src/script')
-rw-r--r--src/script/miniscript.h7
1 files changed, 5 insertions, 2 deletions
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(); }