Skip to content

Commit dcaf9ac

Browse files
committed
Sanity checks on final miniscript produced by Parse
1 parent 3fc78b9 commit dcaf9ac

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

bitcoin/script/miniscript.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,9 +1208,13 @@ inline NodeRef<Key> Parse(Span<const char>& in, const Ctx& ctx)
12081208
}
12091209
}
12101210
}
1211+
1212+
// Sanity checks on the produced miniscript
12111213
assert(constructed.size() == 1);
12121214
if (iter != in.end()) return {};
1213-
return constructed.front();
1215+
const NodeRef<Key> tl_node = std::move(constructed.front());
1216+
if (!tl_node->IsValidTopLevel()) return {};
1217+
return tl_node;
12141218
}
12151219

12161220
/** Decode a script into opcode/push pairs.

0 commit comments

Comments
 (0)