Skip to content

Commit 892436c

Browse files
committed
miniscript: sanity asserts context in ComputeType
1 parent e5aaa3d commit 892436c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/script/miniscript.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ Type ComputeType(Fragment fragment, Type x, Type y, Type z, const std::vector<Ty
7171
assert(n_keys == 1);
7272
} else if (fragment == Fragment::MULTI) {
7373
assert(n_keys >= 1 && n_keys <= MAX_PUBKEYS_PER_MULTISIG);
74+
assert(!IsTapscript(ms_ctx));
7475
} else if (fragment == Fragment::MULTI_A) {
7576
assert(n_keys >= 1 && n_keys <= MAX_PUBKEYS_PER_MULTI_A);
77+
assert(IsTapscript(ms_ctx));
7678
} else {
7779
assert(n_keys == 0);
7880
}
@@ -215,8 +217,12 @@ Type ComputeType(Fragment fragment, Type x, Type y, Type z, const std::vector<Ty
215217
((x << "h"_mst) && (y << "g"_mst)) ||
216218
((x << "i"_mst) && (y << "j"_mst)) ||
217219
((x << "j"_mst) && (y << "i"_mst)))); // k=k_x*k_y*k_z* !(g_x*h_y + h_x*g_y + i_x*j_y + j_x*i_y)
218-
case Fragment::MULTI: return "Bnudemsk"_mst;
219-
case Fragment::MULTI_A: return "Budemsk"_mst;
220+
case Fragment::MULTI: {
221+
return "Bnudemsk"_mst;
222+
}
223+
case Fragment::MULTI_A: {
224+
return "Budemsk"_mst;
225+
}
220226
case Fragment::THRESH: {
221227
bool all_e = true;
222228
bool all_m = true;

0 commit comments

Comments
 (0)