Skip to content

Commit

Permalink
Merge #644: remove unused generic on check_witness
Browse files Browse the repository at this point in the history
d958d21 remove unused generic on check_witness (Riccardo Casatta)

Pull request description:

ACKs for top commit:
  apoelstra:
    ACK d958d21

Tree-SHA512: ec9c828e75949cceef165bfb195ea105c41bad9058aa24b787f6a034ac2e53215f4a62f4405361be9fd4aa4b5bdd77f6521e38887c7c13debaae94c853f1c909
apoelstra committed Feb 27, 2024
2 parents 666918f + d958d21 commit ef3abb6
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/miniscript/context.rs
Original file line number Diff line number Diff line change
@@ -188,7 +188,7 @@ where
/// Check whether the given satisfaction is valid under the ScriptContext
/// For example, segwit satisfactions may fail if the witness len is more
/// 3600 or number of stack elements are more than 100.
fn check_witness<Pk: MiniscriptKey>(_witness: &[Vec<u8>]) -> Result<(), ScriptContextError> {
fn check_witness(_witness: &[Vec<u8>]) -> Result<(), ScriptContextError> {
// Only really need to do this for segwitv0 and legacy
// Bare is already restrcited by standardness rules
// and would reach these limits.
@@ -387,7 +387,7 @@ impl ScriptContext for Legacy {
}
}

fn check_witness<Pk: MiniscriptKey>(witness: &[Vec<u8>]) -> Result<(), ScriptContextError> {
fn check_witness(witness: &[Vec<u8>]) -> Result<(), ScriptContextError> {
// In future, we could avoid by having a function to count only
// len of script instead of converting it.
if witness_to_scriptsig(witness).len() > MAX_SCRIPTSIG_SIZE {
@@ -487,7 +487,7 @@ impl ScriptContext for Segwitv0 {
}
}

fn check_witness<Pk: MiniscriptKey>(witness: &[Vec<u8>]) -> Result<(), ScriptContextError> {
fn check_witness(witness: &[Vec<u8>]) -> Result<(), ScriptContextError> {
if witness.len() > MAX_STANDARD_P2WSH_STACK_ITEMS {
return Err(ScriptContextError::MaxWitnessItemssExceeded {
actual: witness.len(),
@@ -595,7 +595,7 @@ impl ScriptContext for Tap {
}
}

fn check_witness<Pk: MiniscriptKey>(witness: &[Vec<u8>]) -> Result<(), ScriptContextError> {
fn check_witness(witness: &[Vec<u8>]) -> Result<(), ScriptContextError> {
// Note that tapscript has a 1000 limit compared to 100 of segwitv0
if witness.len() > MAX_STACK_SIZE {
return Err(ScriptContextError::MaxWitnessItemssExceeded {
@@ -828,7 +828,7 @@ impl ScriptContext for NoChecks {
"NochecksEcdsa"
}

fn check_witness<Pk: MiniscriptKey>(_witness: &[Vec<u8>]) -> Result<(), ScriptContextError> {
fn check_witness(_witness: &[Vec<u8>]) -> Result<(), ScriptContextError> {
// Only really need to do this for segwitv0 and legacy
// Bare is already restrcited by standardness rules
// and would reach these limits.
2 changes: 1 addition & 1 deletion src/miniscript/mod.rs
Original file line number Diff line number Diff line change
@@ -224,7 +224,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
{
match satisfaction.stack {
satisfy::Witness::Stack(stack) => {
Ctx::check_witness::<Pk>(&stack)?;
Ctx::check_witness(&stack)?;
Ok(stack)
}
satisfy::Witness::Unavailable | satisfy::Witness::Impossible => {

0 comments on commit ef3abb6

Please sign in to comment.