fix comments and hash address instead of hash
This commit is contained in:
parent
e411399f13
commit
e151fbb071
@ -11,7 +11,7 @@ fn combine_key<'a>(address_hash: &'a H256, key: &'a H256) -> H256 {
|
|||||||
{
|
{
|
||||||
let last_dst: &mut [u8] = &mut *dst;
|
let last_dst: &mut [u8] = &mut *dst;
|
||||||
let last_src: &[u8] = &*address_hash;
|
let last_src: &[u8] = &*address_hash;
|
||||||
for (k, a) in last_dst[8..].iter_mut().zip(&last_src[8..]) {
|
for (k, a) in last_dst[12..].iter_mut().zip(&last_src[12..]) {
|
||||||
*k ^= *a
|
*k ^= *a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use util::hash::{FixedHash, H256};
|
use util::hash::{Address, FixedHash, H256};
|
||||||
use util::migration::SimpleMigration;
|
use util::migration::SimpleMigration;
|
||||||
use util::sha3::Hashable;
|
use util::sha3::Hashable;
|
||||||
|
|
||||||
@ -31,12 +31,14 @@ impl SimpleMigration for ToV7 {
|
|||||||
return Some((key, value));
|
return Some((key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
let address_hash = address.sha3();
|
let address_hash = Address::from(address).sha3();
|
||||||
|
|
||||||
// create the xor'd key in place.
|
// create the xor'd key in place.
|
||||||
key.copy_from_slice(&*val_hash);
|
key.copy_from_slice(&*val_hash);
|
||||||
let last_dst: &[u8] = &*address_hash;
|
assert_eq!(key, &*val_hash);
|
||||||
for (k, a) in key[12..].iter_mut().zip(&last_dst[12..]) {
|
|
||||||
|
let last_src: &[u8] = &*address_hash;
|
||||||
|
for (k, a) in key[12..].iter_mut().zip(&last_src[12..]) {
|
||||||
*k ^= *a;
|
*k ^= *a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user