From fa1b569b78890cc5edb22dce91f08acd64cef854 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Mon, 10 Jul 2023 14:34:32 -0400 Subject: [PATCH] 3.8 Document termination of unbounded loop --- coins/bitcoin/src/wallet/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coins/bitcoin/src/wallet/mod.rs b/coins/bitcoin/src/wallet/mod.rs index 7f295d7f..46ffff96 100644 --- a/coins/bitcoin/src/wallet/mod.rs +++ b/coins/bitcoin/src/wallet/mod.rs @@ -115,6 +115,9 @@ impl Scanner { /// If an offset isn't usable, it will be incremented until it is. If this offset is already /// present, None is returned. Else, Some(offset) will be, with the used offset. pub fn register_offset(&mut self, mut offset: Scalar) -> Option { + // This loop will terminate as soon as an even point is found, with any point having a ~50% + // chance of being even + // That means this should terminate within a very small amount of iterations loop { match address(Network::Bitcoin, self.key + (ProjectivePoint::GENERATOR * offset)) { Some(address) => {