Skip to content

Commit d4e828e

Browse files
OttoAllmendingerllm-git
andcommitted
feat(wasm-utxo): refactor polymod function to use iterator for clarity
Use enumerate() with iterator in cashaddr polymod calculation for improved readability. This eliminates manual indexing while maintaining the same functionality. Issue: BTC-2652 Co-authored-by: llm-git <[email protected]>
1 parent 8b351d2 commit d4e828e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/wasm-utxo/src/address/cashaddr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ fn polymod(values: &[u8]) -> u64 {
265265
let c0 = (c >> 35) as u8;
266266
c = ((c & 0x07ffffffff) << 5) ^ (d as u64);
267267

268-
for i in 0..5 {
268+
for (i, &generator) in generators.iter().enumerate() {
269269
if (c0 & (1 << i)) != 0 {
270-
c ^= generators[i];
270+
c ^= generator;
271271
}
272272
}
273273
}

0 commit comments

Comments
 (0)