mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-07 03:22:20 +00:00
fix(hashing): reverse loop #146
Signed-off-by: Johns Beharry <johns@peakshift.com>
This commit is contained in:
parent
998e2ed7eb
commit
fa2bae4cc1
@ -1,11 +1,12 @@
|
|||||||
use types::{Hash256}
|
use types::{Hash256}
|
||||||
use hashing::canonical_hash;
|
use hashing::canonical_hash;
|
||||||
|
use std::iter::range_step;
|
||||||
|
|
||||||
fn merkle_root(values: Vec<T>) -> Hash256 {
|
fn merkle_root(values: Vec<T>) -> Hash256 {
|
||||||
let mut o = vec![0; values.len()];
|
let mut o = vec![0; values.len()];
|
||||||
o.append(values);
|
o.append(values);
|
||||||
|
|
||||||
for v in &values {
|
for v in range_step(values - 1, 0, -1) {
|
||||||
canonical_hash(v.as_bytes());
|
canonical_hash(v.as_bytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user