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

get rid of hidden mutability of Spec #10904

Merged
merged 4 commits into from
Jul 30, 2019
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
8 changes: 6 additions & 2 deletions ethcore/pod/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ pub struct PodState(BTreeMap<Address, PodAccount>);

impl PodState {
/// Get the underlying map.
pub fn get(&self) -> &BTreeMap<Address, PodAccount> { &self.0 }
pub fn get(&self) -> &BTreeMap<Address, PodAccount> {
&self.0
}

/// Get the root hash of the trie of the RLP of this.
pub fn root(&self) -> H256 {
sec_trie_root(self.0.iter().map(|(k, v)| (k, v.rlp())))
}

/// Drain object to get the underlying map.
pub fn drain(self) -> BTreeMap<Address, PodAccount> { self.0 }
pub fn drain(self) -> BTreeMap<Address, PodAccount> {
self.0
}
}

impl From<ethjson::blockchain::State> for PodState {
Expand Down
1 change: 0 additions & 1 deletion ethcore/src/json_tests/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub fn json_chain_test<H: FnMut(&str, HookType)>(json_data: &[u8], start_stop_ho
let state = From::from(blockchain.pre_state.clone());
spec.set_genesis_state(state).expect("Failed to overwrite genesis state");
spec.overwrite_genesis_params(genesis);
assert!(spec.is_state_root_valid());
spec
};

Expand Down
Loading