diff --git a/src/blockdata/block.rs b/src/blockdata/block.rs index 8ca1fa0c..28aeda59 100644 --- a/src/blockdata/block.rs +++ b/src/blockdata/block.rs @@ -195,8 +195,8 @@ impl Block { // commitment is in the last output that starts with below magic if let Some(pos) = coinbase.output.iter() .rposition(|o| { - o.script_pubkey.len () >= 38 && - o.script_pubkey[0..6] == [0x6a, 0x24, 0xaa, 0x21, 0xa9, 0xed] }) { + o.script_pubkey.len () >= 38 + && o.script_pubkey[0..6] == [0x6a, 0x24, 0xaa, 0x21, 0xa9, 0xed] }) { let commitment = WitnessCommitment::from_slice(&coinbase.output[pos].script_pubkey.as_bytes()[6..38]).unwrap(); // witness reserved value is in coinbase input witness let witness_vec: Vec<_> = coinbase.input[0].witness.iter().collect(); diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index adc702f7..80c5c580 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -420,21 +420,21 @@ impl Script { /// Checks whether a script pubkey is a p2sh output #[inline] pub fn is_p2sh(&self) -> bool { - self.0.len() == 23 && - self.0[0] == opcodes::all::OP_HASH160.into_u8() && - self.0[1] == opcodes::all::OP_PUSHBYTES_20.into_u8() && - self.0[22] == opcodes::all::OP_EQUAL.into_u8() + self.0.len() == 23 + && self.0[0] == opcodes::all::OP_HASH160.into_u8() + && self.0[1] == opcodes::all::OP_PUSHBYTES_20.into_u8() + && self.0[22] == opcodes::all::OP_EQUAL.into_u8() } /// Checks whether a script pubkey is a p2pkh output #[inline] pub fn is_p2pkh(&self) -> bool { - self.0.len() == 25 && - self.0[0] == opcodes::all::OP_DUP.into_u8() && - self.0[1] == opcodes::all::OP_HASH160.into_u8() && - self.0[2] == opcodes::all::OP_PUSHBYTES_20.into_u8() && - self.0[23] == opcodes::all::OP_EQUALVERIFY.into_u8() && - self.0[24] == opcodes::all::OP_CHECKSIG.into_u8() + self.0.len() == 25 + && self.0[0] == opcodes::all::OP_DUP.into_u8() + && self.0[1] == opcodes::all::OP_HASH160.into_u8() + && self.0[2] == opcodes::all::OP_PUSHBYTES_20.into_u8() + && self.0[23] == opcodes::all::OP_EQUALVERIFY.into_u8() + && self.0[24] == opcodes::all::OP_CHECKSIG.into_u8() } /// Checks whether a script pubkey is a p2pk output @@ -476,25 +476,25 @@ impl Script { /// Checks whether a script pubkey is a p2wsh output #[inline] pub fn is_v0_p2wsh(&self) -> bool { - self.0.len() == 34 && - self.witness_version() == Some(WitnessVersion::V0) && - self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8() + self.0.len() == 34 + && self.witness_version() == Some(WitnessVersion::V0) + && self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8() } /// Checks whether a script pubkey is a p2wpkh output #[inline] pub fn is_v0_p2wpkh(&self) -> bool { - self.0.len() == 22 && - self.witness_version() == Some(WitnessVersion::V0) && - self.0[1] == opcodes::all::OP_PUSHBYTES_20.into_u8() + self.0.len() == 22 + && self.witness_version() == Some(WitnessVersion::V0) + && self.0[1] == opcodes::all::OP_PUSHBYTES_20.into_u8() } /// Checks whether a script pubkey is a P2TR output #[inline] pub fn is_v1_p2tr(&self) -> bool { - self.0.len() == 34 && - self.witness_version() == Some(WitnessVersion::V1) && - self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8() + self.0.len() == 34 + && self.witness_version() == Some(WitnessVersion::V1) + && self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8() } /// Check if this is an OP_RETURN output