Skip to content

Commit

Permalink
Remove old way of account hashing
Browse files Browse the repository at this point in the history
Account data hashing used to use different ways of hashing on different
clusters.  That is no longer the case, but the old code still existed.
This commit removes that old, now used code.

**NOTE** The golden hash values in bank.rs needed to be updated.  Since
the original code that selected the hash algorithm used `if >` instead
of `if >=`, this meant that the genesis block's hash _always_ used the
old hashing method, which is no longer valid.

Validated by running `cargo test` successfully.
  • Loading branch information
brooksprumo committed Apr 13, 2021
1 parent 5c6b38a commit 17aa45f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 202 deletions.
4 changes: 1 addition & 3 deletions runtime/src/accounts_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use dashmap::DashMap;
use solana_sdk::{
account::{AccountSharedData, ReadableAccount},
clock::Slot,
genesis_config::ClusterType,
hash::Hash,
pubkey::Pubkey,
};
Expand Down Expand Up @@ -114,7 +113,7 @@ pub struct CachedAccountInner {
}

impl CachedAccountInner {
pub fn hash(&self, cluster_type: ClusterType) -> Hash {
pub fn hash(&self) -> Hash {
let hash = self.hash.read().unwrap();
match *hash {
Some(hash) => hash,
Expand All @@ -124,7 +123,6 @@ impl CachedAccountInner {
self.slot,
&self.account,
&self.pubkey,
&cluster_type,
);
*self.hash.write().unwrap() = Some(hash);
hash
Expand Down
Loading

0 comments on commit 17aa45f

Please sign in to comment.