Skip to content

Commit

Permalink
miniscript/context: don't check witness script size in check_witness
Browse files Browse the repository at this point in the history
It's called at satisfaction time, and this limit is checked at parse
time already.

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
  • Loading branch information
darosior committed Nov 29, 2020
1 parent 5834a41 commit 4c94e79
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/miniscript/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use miniscript::limits::{
};
use miniscript::types;
use std::fmt;
use util::{witness_size, witness_to_scriptsig};
use util::witness_to_scriptsig;
use Error;
use {Miniscript, MiniscriptKey, Terminal};
/// Error for Script Context
Expand Down Expand Up @@ -321,9 +321,7 @@ impl ScriptContext for Segwitv0 {
fn check_witness<Pk: MiniscriptKey, Ctx: ScriptContext>(
witness: &[Vec<u8>],
) -> Result<(), ScriptContextError> {
if witness_size(witness) > MAX_STANDARD_P2WSH_SCRIPT_SIZE {
return Err(ScriptContextError::MaxScriptSigSizeExceeded);
} else if witness.len() > MAX_STANDARD_P2WSH_STACK_ITEMS {
if witness.len() > MAX_STANDARD_P2WSH_STACK_ITEMS {
return Err(ScriptContextError::MaxWitnessItemssExceeded);
}
Ok(())
Expand Down

0 comments on commit 4c94e79

Please sign in to comment.