From 746a73a468899f6455c741bc1affb46268b85fd4 Mon Sep 17 00:00:00 2001 From: Herr Seppia Date: Tue, 19 Mar 2024 16:58:06 +0100 Subject: [PATCH] Remove iter.rev Resolves #139 --- CHANGELOG.md | 5 +++++ src/kbucket/key.rs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a37e84c..e4685c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Remove `iter.rev()` from BinaryID verification [#139] + ## [0.6.0] - 2023-11-01 ### Added @@ -126,6 +130,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#115]: https://github.com/dusk-network/kadcast/issues/115 [#117]: https://github.com/dusk-network/kadcast/issues/117 [#123]: https://github.com/dusk-network/kadcast/issues/123 +[#139]: https://github.com/dusk-network/kadcast/issues/139 diff --git a/src/kbucket/key.rs b/src/kbucket/key.rs index f28f600..0c16b83 100644 --- a/src/kbucket/key.rs +++ b/src/kbucket/key.rs @@ -112,7 +112,7 @@ impl BinaryID { let nonce_bytes = nonce.to_le_bytes(); hasher.update(nonce_bytes); if BinaryID::verify_difficulty( - &mut hasher.finalize_reset().iter().rev(), + &mut hasher.finalize_reset().iter(), K_DIFF_PRODUCED_BIT, ) { return Self { @@ -131,7 +131,7 @@ impl BinaryID { hasher.update(self.bytes); hasher.update(self.nonce); BinaryID::verify_difficulty( - &mut hasher.finalize().iter().rev(), + &mut hasher.finalize().iter(), K_DIFF_MIN_BIT, ) }