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:
Tobin C. Harding 2024-01-23 10:48:33 +11:00
parent 671dc0e9e0
commit dae16f052c
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 4 deletions

View File

@ -985,10 +985,8 @@ impl Transaction {
/// Returns whether or not to serialize transaction as specified in BIP-144.
fn uses_segwit_serialization(&self) -> bool {
for input in &self.input {
if !input.witness.is_empty() {
return true;
}
if self.input.iter().any(|input| !input.witness.is_empty()) {
return true;
}
// To avoid serialization ambiguity, no inputs means we use BIP141 serialization (see
// `Transaction` docs for full explanation).