diff options
author | Antoine Poinsot <darosior@protonmail.com> | 2023-01-23 12:45:49 +0100 |
---|---|---|
committer | Antoine Poinsot <darosior@protonmail.com> | 2023-08-25 11:56:09 +0200 |
commit | 4ab382c2cdb09fb4056711b4336807845cbe1ad5 (patch) | |
tree | 15cf9ecb6b8d066b71bf1ec59defc5324c7600a0 /src/script | |
parent | 7bf078f2b7d4a0339d053144b4fb35fe020dac25 (diff) |
miniscript: make GetStackSize independent of P2WSH context
It was taking into account the P2WSH script push in the number of stack
elements.
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/miniscript.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/script/miniscript.h b/src/script/miniscript.h index b58740a125..40c3af5254 100644 --- a/src/script/miniscript.h +++ b/src/script/miniscript.h @@ -1148,16 +1148,16 @@ public: return true; } - /** Return the maximum number of stack elements needed to satisfy this script non-malleably, including - * the script push. */ + /** Return the maximum number of stack elements needed to satisfy this script non-malleably. + * This does not account for the P2WSH script push. */ std::optional<uint32_t> GetStackSize() const { if (!ss.sat.valid) return {}; - return ss.sat.value + 1; + return ss.sat.value; } //! Check the maximum stack size for this script against the policy limit. bool CheckStackSize() const { - if (const auto ss = GetStackSize()) return *ss - 1 <= MAX_STANDARD_P2WSH_STACK_ITEMS; + if (const auto ss = GetStackSize()) return *ss <= MAX_STANDARD_P2WSH_STACK_ITEMS; return true; } |