Skip to content

Commit

Permalink
Merge #75: call reduce0 from reduce1/2
Browse files Browse the repository at this point in the history
085129f call reduce0 from reduce1/2 (Riccardo Casatta)

Pull request description:

  once the terminal is wrapped it does the same checks and produce the same side effects

  same as rust-bitcoin/rust-miniscript#643

ACKs for top commit:
  apoelstra:
    ACK 085129f

Tree-SHA512: 55ee7bdb5bbf3419808c5e0ab2d232feba6b91256e5ae11736726737d0fbb2c1cdfaa6df796c8cfbc3c81265eddeb83ddd9571f1a8e062a8fc8fcfea3bb13c0c
  • Loading branch information
apoelstra committed Mar 4, 2024
2 parents 32fee57 + 085129f commit b2a6912
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/miniscript/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext, Ext: Extension> TerminalStack<Pk, Ct
let top = self.pop().unwrap();
let wrapped_ms = wrap(Arc::new(top));

let ty = Type::type_check(&wrapped_ms)?;
let ext = ExtData::type_check(&wrapped_ms)?;
let ms = Miniscript {
node: wrapped_ms,
ty,
ext,
phantom: PhantomData,
};
Ctx::check_global_validity(&ms)?;
self.0.push(ms);
Ok(())
self.reduce0(wrapped_ms)
}

///reduce, type check and push a 2-arg node
Expand All @@ -254,17 +244,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext, Ext: Extension> TerminalStack<Pk, Ct

let wrapped_ms = wrap(Arc::new(left), Arc::new(right));

let ty = Type::type_check(&wrapped_ms)?;
let ext = ExtData::type_check(&wrapped_ms)?;
let ms = Miniscript {
node: wrapped_ms,
ty,
ext,
phantom: PhantomData,
};
Ctx::check_global_validity(&ms)?;
self.0.push(ms);
Ok(())
self.reduce0(wrapped_ms)
}
}

Expand Down

0 comments on commit b2a6912

Please sign in to comment.