Skip to content

Commit d241544

Browse files
committed
Simplification of instruction iterators use by descriptors
1 parent 3515c6a commit d241544

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/descriptor/create_descriptor.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ use ToPublicKey;
2424
/// NOTE: Miniscript pushes should only be either boolean, 1 or 0, signatures, and hash preimages.
2525
/// As per the current implementation, PUSH_NUM2 results in an error
2626
fn instr_to_stackelem<'txin>(
27-
ins: &Result<Instruction<'txin>, bitcoin::blockdata::script::Error>,
27+
ins: Result<Instruction<'txin>, bitcoin::blockdata::script::Error>,
2828
) -> Result<StackElement<'txin>, Error> {
29-
match *ins {
29+
match ins {
3030
//Also covers the dissatisfied case as PushBytes0
3131
Ok(Instruction::PushBytes(v)) => Ok(StackElement::from(v)),
3232
Ok(Instruction::Op(opcodes::all::OP_PUSHNUM_1)) => Ok(StackElement::Satisfied),
@@ -42,7 +42,7 @@ fn parse_scriptsig_top<'txin>(
4242
) -> Result<(Vec<u8>, Stack<'txin>), Error> {
4343
let stack: Result<Vec<StackElement>, Error> = script_sig
4444
.instructions_minimal()
45-
.map(|instr| instr_to_stackelem(&instr))
45+
.map(instr_to_stackelem)
4646
.collect();
4747
let mut stack = stack?;
4848
if let Some(StackElement::Push(pk_bytes)) = stack.pop() {
@@ -64,7 +64,7 @@ fn verify_p2pk<'txin>(
6464
if let Ok(pk) = bitcoin::PublicKey::from_slice(&pk_bytes[1..script_pubkey_len - 1]) {
6565
let stack: Result<Vec<StackElement>, Error> = script_sig
6666
.instructions_minimal()
67-
.map(|instr| instr_to_stackelem(&instr))
67+
.map(instr_to_stackelem)
6868
.collect();
6969
if !witness.is_empty() {
7070
Err(Error::NonEmptyWitness)
@@ -228,7 +228,7 @@ pub fn from_txin_with_witness_stack<'txin>(
228228
//bare
229229
let stack: Result<Vec<StackElement>, Error> = script_sig
230230
.instructions_minimal()
231-
.map(|instr| instr_to_stackelem(&instr))
231+
.map(instr_to_stackelem)
232232
.collect();
233233
if !witness.is_empty() {
234234
return Err(Error::NonEmptyWitness);

0 commit comments

Comments
 (0)