Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Some tiny modifications. #8163

Merged
merged 1 commit into from
Mar 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ethcore/src/state/account.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub struct Account {
storage_changes: HashMap<H256, H256>,
// Code hash of the account.
code_hash: H256,
// Size of the accoun code.
// Size of the account code.
code_size: Option<usize>,
// Code cache of the account.
code_cache: Arc<Bytes>,
Expand Down Expand Up @@ -186,7 +186,7 @@ impl Account {
}

/// Get (and cache) the contents of the trie's storage at `key`.
/// Takes modifed storage into account.
/// Takes modified storage into account.
pub fn storage_at(&self, db: &HashDB, key: &H256) -> trie::Result<H256> {
if let Some(value) = self.cached_storage_at(key) {
return Ok(value);
Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/state/mod.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ impl<B: Backend> State<B> {
pub fn new(mut db: B, account_start_nonce: U256, factories: Factories) -> State<B> {
let mut root = H256::new();
{
// init trie and reset root too null
// init trie and reset root to null
let _ = factories.trie.create(db.as_hashdb_mut(), &mut root);
}

Expand Down Expand Up @@ -553,8 +553,8 @@ impl<B: Backend> State<B> {
// 2. If there's an entry for the account in the global cache check for the key or load it into that account.
// 3. If account is missing in the global cache load it into the local cache and cache the key there.

// check local cache first without updating
{
// check local cache first without updating
let local_cache = self.cache.borrow_mut();
let mut local_account = None;
if let Some(maybe_acc) = local_cache.get(address) {
Expand Down
12 changes: 6 additions & 6 deletions ethcore/src/state_db.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,6 @@ impl state::Backend for StateDB {
cache.accounts.get_mut(addr).map(|a| a.as_ref().map(|a| a.clone_basic()))
}

fn get_cached_code(&self, hash: &H256) -> Option<Arc<Vec<u8>>> {
let mut cache = self.code_cache.lock();

cache.get_mut(hash).map(|code| code.clone())
}

fn get_cached<F, U>(&self, a: &Address, f: F) -> Option<U>
where F: FnOnce(Option<&mut Account>) -> U {
let mut cache = self.account_cache.lock();
Expand All @@ -455,6 +449,12 @@ impl state::Backend for StateDB {
cache.accounts.get_mut(a).map(|c| f(c.as_mut()))
}

fn get_cached_code(&self, hash: &H256) -> Option<Arc<Vec<u8>>> {
let mut cache = self.code_cache.lock();

cache.get_mut(hash).map(|code| code.clone())
}

fn note_non_null_account(&self, address: &Address) {
trace!(target: "account_bloom", "Note account bloom: {:?}", address);
let mut bloom = self.account_bloom.lock();
Expand Down