Fix State cloning.
This commit is contained in:
parent
fc211f0934
commit
43e1d89067
@ -405,6 +405,25 @@ fn should_apply_create_transaction() {
|
||||
assert_eq!(result.trace, expected_trace);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_work_when_cloned() {
|
||||
init_log();
|
||||
|
||||
let a = Address::zero();
|
||||
|
||||
let temp = RandomTempPath::new();
|
||||
let mut state = {
|
||||
let mut state = get_temp_state_in(temp.as_path());
|
||||
assert_eq!(state.exists(&a), false);
|
||||
state.inc_nonce(&a);
|
||||
state.commit();
|
||||
state.clone()
|
||||
};
|
||||
|
||||
state.inc_nonce(&a);
|
||||
state.commit();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_trace_failed_create_transaction() {
|
||||
init_log();
|
||||
|
@ -130,7 +130,7 @@ impl HashDB for ArchiveDB {
|
||||
impl JournalDB for ArchiveDB {
|
||||
fn spawn(&self) -> Box<JournalDB> {
|
||||
Box::new(ArchiveDB {
|
||||
overlay: MemoryDB::new(),
|
||||
overlay: self.overlay.clone(),
|
||||
backing: self.backing.clone(),
|
||||
latest_era: self.latest_era,
|
||||
})
|
||||
|
@ -322,7 +322,7 @@ impl HashDB for EarlyMergeDB {
|
||||
impl JournalDB for EarlyMergeDB {
|
||||
fn spawn(&self) -> Box<JournalDB> {
|
||||
Box::new(EarlyMergeDB {
|
||||
overlay: MemoryDB::new(),
|
||||
overlay: self.overlay.clone(),
|
||||
backing: self.backing.clone(),
|
||||
refs: self.refs.clone(),
|
||||
latest_era: self.latest_era.clone(),
|
||||
|
@ -85,7 +85,7 @@ impl HeapSizeOf for JournalEntry {
|
||||
impl Clone for OverlayRecentDB {
|
||||
fn clone(&self) -> OverlayRecentDB {
|
||||
OverlayRecentDB {
|
||||
transaction_overlay: MemoryDB::new(),
|
||||
transaction_overlay: self.transaction_overlay.clone(),
|
||||
backing: self.backing.clone(),
|
||||
journal_overlay: self.journal_overlay.clone(),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user