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

Removed need for mutation in State. #46

Merged
merged 6 commits into from Dec 20, 2015
Merged

Removed need for mutation in State. #46

merged 6 commits into from Dec 20, 2015

Conversation

gavofyork
Copy link
Contributor

No description provided.

self.cache.borrow_mut().entry(a.clone()).or_insert_with(||
TrieDB::new(&self.db, &self.root).get(&a).map(|rlp| Account::from_rlp(rlp)));
if self.cache.borrow().get(a).unwrap().is_none() {
self.cache.borrow_mut().insert(a.clone(), Some(default()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unwrapping Account is quite confusing.... I think we should consider replacing RefCell<HashMap<Address, Option<Account>>>, with something more readable. eg.

enum Existance<T> {
  Live(T),
  Removed
}

impl<T> Existance<T> {
  fn is_live() {
  // ...
  }

  fn is_removed() {
  // ...
  }
}

RefCell<HashMap<Address, Existance<Account>>>,

*But, of course, not as part of this pr.

debris added a commit that referenced this pull request Dec 20, 2015
Removed need for mutation in State.
@debris debris merged commit 9700d02 into master Dec 20, 2015
dvdplm added a commit that referenced this pull request Dec 12, 2019
The elastic-array crate is a fine piece of software but it'd be good to prefer crates that are commonly used in the ecosystem and likely to be well maintained. smallvec is at v1.0 and generally well-regarded.

Related PRs:

	- [parity-common #282](paritytech/parity-common#282)
	– [trie-db #46](paritytech/trie#46)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants