From b9950b75840f2fb6fc5020ebff2eaa0f2d9a9025 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Sat, 29 Jan 2022 10:10:29 +0100 Subject: [PATCH] miniscript: fix thresh script size computation for threshold > 16 --- bitcoin/script/miniscript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitcoin/script/miniscript.cpp b/bitcoin/script/miniscript.cpp index 7abcaf9..23acb75 100644 --- a/bitcoin/script/miniscript.cpp +++ b/bitcoin/script/miniscript.cpp @@ -275,7 +275,7 @@ size_t ComputeScriptLen(NodeType nodetype, Type sub0typ, size_t subsize, uint32_ case NodeType::OR_C: return subsize + 2; case NodeType::OR_I: return subsize + 3; case NodeType::ANDOR: return subsize + 3; - case NodeType::THRESH: return subsize + n_subs + 1; + case NodeType::THRESH: return subsize + n_subs + CScript(k).size(); case NodeType::MULTI: return subsize + 3 + (n_keys > 16) + (k > 16) + 34 * n_keys; } assert(false);