Include account.owner into account hash (#9917)

automerge
This commit is contained in:
Ryo Onodera 2020-05-08 05:01:11 +09:00 committed by GitHub
parent 3757754c89
commit 2ac50177a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -1303,6 +1303,7 @@ impl AccountsDB {
Self::hash_account_data(
slot,
account.account_meta.lamports,
&account.account_meta.owner,
account.account_meta.executable,
account.account_meta.rent_epoch,
account.data,
@ -1314,6 +1315,7 @@ impl AccountsDB {
Self::hash_account_data(
slot,
account.lamports,
&account.owner,
account.executable,
account.rent_epoch,
&account.data,
@ -1339,6 +1341,7 @@ impl AccountsDB {
pub fn hash_account_data(
slot: Slot,
lamports: u64,
owner: &Pubkey,
executable: bool,
rent_epoch: Epoch,
data: &[u8],
@ -1368,6 +1371,7 @@ impl AccountsDB {
hasher.hash(&[0u8; 1]);
}
hasher.hash(&owner.as_ref());
hasher.hash(&pubkey.as_ref());
hasher.result()
@ -3469,7 +3473,7 @@ pub mod tests {
};
let account = stored_account.clone_account();
let expected_account_hash =
Hash::from_str("GGTsxvxwnMsNfN6yYbBVQaRgvbVLfxeWnGXNyB8iXDyE").unwrap();
Hash::from_str("5iRNZVcAnq9JLYjSF2ibFhGEeq48r9Eq9HXxwm3BxywN").unwrap();
assert_eq!(
AccountsDB::hash_stored_account(slot, &stored_account),