fix comments and hash address instead of hash

This commit is contained in:
Robert Habermeier 2016-07-04 19:05:32 +02:00
parent e411399f13
commit e151fbb071
2 changed files with 7 additions and 5 deletions

View File

@ -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_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
}
}

View File

@ -1,4 +1,4 @@
use util::hash::{FixedHash, H256};
use util::hash::{Address, FixedHash, H256};
use util::migration::SimpleMigration;
use util::sha3::Hashable;
@ -31,12 +31,14 @@ impl SimpleMigration for ToV7 {
return Some((key, value));
}
let address_hash = address.sha3();
let address_hash = Address::from(address).sha3();
// create the xor'd key in place.
key.copy_from_slice(&*val_hash);
let last_dst: &[u8] = &*address_hash;
for (k, a) in key[12..].iter_mut().zip(&last_dst[12..]) {
assert_eq!(key, &*val_hash);
let last_src: &[u8] = &*address_hash;
for (k, a) in key[12..].iter_mut().zip(&last_src[12..]) {
*k ^= *a;
}
}