diff options
author | Pieter Wuille <pieter@wuille.net> | 2023-02-25 16:05:04 -0500 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2023-02-28 09:22:42 -0500 |
commit | bcec5ab4ff1039c0c309dbbb9953adbd0a4f3e88 (patch) | |
tree | b90eb91c33f67dc448261c99e2397cc0ae0c5df0 /src/script | |
parent | 213fffa5138229eac2d4a9eda0f643fe90870378 (diff) |
Make miniscript fuzzers avoid ops limit
Keep track of the total number of ops the constructed script will have
during miniscript_stable and miniscript_smart fuzzers' GenNode, so it
can abort early if the 201 ops limit would be exceeded.
Also add a self-check that the final constructed node has the predicted
ops size limit, so we know the fuzzer's logic for keeping track of this
is correct.
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/miniscript.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/script/miniscript.h b/src/script/miniscript.h index c42b530c4d..bb42bf3c92 100644 --- a/src/script/miniscript.h +++ b/src/script/miniscript.h @@ -1136,6 +1136,9 @@ public: //! Return the maximum number of ops needed to satisfy this script non-malleably. uint32_t GetOps() const { return ops.count + ops.sat.value; } + //! Return the number of ops in the script (not counting the dynamic ones that depend on execution). + uint32_t GetStaticOps() const { return ops.count; } + //! Check the ops limit of this script against the consensus limit. bool CheckOpsLimit() const { return GetOps() <= MAX_OPS_PER_SCRIPT; } |