Use any method on iterator
We have `Iterator::any` which better shows whats going on in this loop. Refactor only, no logic changes.
This commit is contained in:
parent
671dc0e9e0
commit
dae16f052c
|
@ -985,11 +985,9 @@ impl Transaction {
|
||||||
|
|
||||||
/// Returns whether or not to serialize transaction as specified in BIP-144.
|
/// Returns whether or not to serialize transaction as specified in BIP-144.
|
||||||
fn uses_segwit_serialization(&self) -> bool {
|
fn uses_segwit_serialization(&self) -> bool {
|
||||||
for input in &self.input {
|
if self.input.iter().any(|input| !input.witness.is_empty()) {
|
||||||
if !input.witness.is_empty() {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// To avoid serialization ambiguity, no inputs means we use BIP141 serialization (see
|
// To avoid serialization ambiguity, no inputs means we use BIP141 serialization (see
|
||||||
// `Transaction` docs for full explanation).
|
// `Transaction` docs for full explanation).
|
||||||
self.input.is_empty()
|
self.input.is_empty()
|
||||||
|
|
Loading…
Reference in New Issue