Skip to content

Commit fde425f

Browse files
committed
Fail on witness failures
1 parent 1bff4d5 commit fde425f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/miniscript/mod.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,13 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
303303
match satisfy::Satisfaction::satisfy(&self.node, &satisfier, self.ty.mall.safe, to_pk_ctx)
304304
.stack
305305
{
306-
satisfy::Witness::Stack(stack) => Some(stack),
306+
satisfy::Witness::Stack(stack) => {
307+
if Ctx::check_witness::<Pk, Ctx>(&stack).is_err() {
308+
None
309+
} else {
310+
Some(stack)
311+
}
312+
}
307313
satisfy::Witness::Unavailable | satisfy::Witness::Impossible => None,
308314
}
309315
}
@@ -326,7 +332,13 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
326332
)
327333
.stack
328334
{
329-
satisfy::Witness::Stack(stack) => Some(stack),
335+
satisfy::Witness::Stack(stack) => {
336+
if Ctx::check_witness::<Pk, Ctx>(&stack).is_err() {
337+
None
338+
} else {
339+
Some(stack)
340+
}
341+
}
330342
satisfy::Witness::Unavailable | satisfy::Witness::Impossible => None,
331343
}
332344
}

0 commit comments

Comments
 (0)