Skip to content

Commit 7df7d37

Browse files
committed
Put && operator at front of line
In an effort to make code containing multi-line logical AND clearer to read put the operator at the start of the line.
1 parent 6c596f5 commit 7df7d37

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/blockdata/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ impl Block {
195195
// commitment is in the last output that starts with below magic
196196
if let Some(pos) = coinbase.output.iter()
197197
.rposition(|o| {
198-
o.script_pubkey.len () >= 38 &&
199-
o.script_pubkey[0..6] == [0x6a, 0x24, 0xaa, 0x21, 0xa9, 0xed] }) {
198+
o.script_pubkey.len () >= 38
199+
&& o.script_pubkey[0..6] == [0x6a, 0x24, 0xaa, 0x21, 0xa9, 0xed] }) {
200200
let commitment = WitnessCommitment::from_slice(&coinbase.output[pos].script_pubkey.as_bytes()[6..38]).unwrap();
201201
// witness reserved value is in coinbase input witness
202202
let witness_vec: Vec<_> = coinbase.input[0].witness.iter().collect();

src/blockdata/script.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -420,21 +420,21 @@ impl Script {
420420
/// Checks whether a script pubkey is a p2sh output
421421
#[inline]
422422
pub fn is_p2sh(&self) -> bool {
423-
self.0.len() == 23 &&
424-
self.0[0] == opcodes::all::OP_HASH160.into_u8() &&
425-
self.0[1] == opcodes::all::OP_PUSHBYTES_20.into_u8() &&
426-
self.0[22] == opcodes::all::OP_EQUAL.into_u8()
423+
self.0.len() == 23
424+
&& self.0[0] == opcodes::all::OP_HASH160.into_u8()
425+
&& self.0[1] == opcodes::all::OP_PUSHBYTES_20.into_u8()
426+
&& self.0[22] == opcodes::all::OP_EQUAL.into_u8()
427427
}
428428

429429
/// Checks whether a script pubkey is a p2pkh output
430430
#[inline]
431431
pub fn is_p2pkh(&self) -> bool {
432-
self.0.len() == 25 &&
433-
self.0[0] == opcodes::all::OP_DUP.into_u8() &&
434-
self.0[1] == opcodes::all::OP_HASH160.into_u8() &&
435-
self.0[2] == opcodes::all::OP_PUSHBYTES_20.into_u8() &&
436-
self.0[23] == opcodes::all::OP_EQUALVERIFY.into_u8() &&
437-
self.0[24] == opcodes::all::OP_CHECKSIG.into_u8()
432+
self.0.len() == 25
433+
&& self.0[0] == opcodes::all::OP_DUP.into_u8()
434+
&& self.0[1] == opcodes::all::OP_HASH160.into_u8()
435+
&& self.0[2] == opcodes::all::OP_PUSHBYTES_20.into_u8()
436+
&& self.0[23] == opcodes::all::OP_EQUALVERIFY.into_u8()
437+
&& self.0[24] == opcodes::all::OP_CHECKSIG.into_u8()
438438
}
439439

440440
/// Checks whether a script pubkey is a p2pk output
@@ -476,25 +476,25 @@ impl Script {
476476
/// Checks whether a script pubkey is a p2wsh output
477477
#[inline]
478478
pub fn is_v0_p2wsh(&self) -> bool {
479-
self.0.len() == 34 &&
480-
self.witness_version() == Some(WitnessVersion::V0) &&
481-
self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8()
479+
self.0.len() == 34
480+
&& self.witness_version() == Some(WitnessVersion::V0)
481+
&& self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8()
482482
}
483483

484484
/// Checks whether a script pubkey is a p2wpkh output
485485
#[inline]
486486
pub fn is_v0_p2wpkh(&self) -> bool {
487-
self.0.len() == 22 &&
488-
self.witness_version() == Some(WitnessVersion::V0) &&
489-
self.0[1] == opcodes::all::OP_PUSHBYTES_20.into_u8()
487+
self.0.len() == 22
488+
&& self.witness_version() == Some(WitnessVersion::V0)
489+
&& self.0[1] == opcodes::all::OP_PUSHBYTES_20.into_u8()
490490
}
491491

492492
/// Checks whether a script pubkey is a P2TR output
493493
#[inline]
494494
pub fn is_v1_p2tr(&self) -> bool {
495-
self.0.len() == 34 &&
496-
self.witness_version() == Some(WitnessVersion::V1) &&
497-
self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8()
495+
self.0.len() == 34
496+
&& self.witness_version() == Some(WitnessVersion::V1)
497+
&& self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8()
498498
}
499499

500500
/// Check if this is an OP_RETURN output

0 commit comments

Comments
 (0)