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);
|
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]
|
#[test]
|
||||||
fn should_trace_failed_create_transaction() {
|
fn should_trace_failed_create_transaction() {
|
||||||
init_log();
|
init_log();
|
||||||
|
@ -130,7 +130,7 @@ impl HashDB for ArchiveDB {
|
|||||||
impl JournalDB for ArchiveDB {
|
impl JournalDB for ArchiveDB {
|
||||||
fn spawn(&self) -> Box<JournalDB> {
|
fn spawn(&self) -> Box<JournalDB> {
|
||||||
Box::new(ArchiveDB {
|
Box::new(ArchiveDB {
|
||||||
overlay: MemoryDB::new(),
|
overlay: self.overlay.clone(),
|
||||||
backing: self.backing.clone(),
|
backing: self.backing.clone(),
|
||||||
latest_era: self.latest_era,
|
latest_era: self.latest_era,
|
||||||
})
|
})
|
||||||
|
@ -322,7 +322,7 @@ impl HashDB for EarlyMergeDB {
|
|||||||
impl JournalDB for EarlyMergeDB {
|
impl JournalDB for EarlyMergeDB {
|
||||||
fn spawn(&self) -> Box<JournalDB> {
|
fn spawn(&self) -> Box<JournalDB> {
|
||||||
Box::new(EarlyMergeDB {
|
Box::new(EarlyMergeDB {
|
||||||
overlay: MemoryDB::new(),
|
overlay: self.overlay.clone(),
|
||||||
backing: self.backing.clone(),
|
backing: self.backing.clone(),
|
||||||
refs: self.refs.clone(),
|
refs: self.refs.clone(),
|
||||||
latest_era: self.latest_era.clone(),
|
latest_era: self.latest_era.clone(),
|
||||||
|
@ -85,7 +85,7 @@ impl HeapSizeOf for JournalEntry {
|
|||||||
impl Clone for OverlayRecentDB {
|
impl Clone for OverlayRecentDB {
|
||||||
fn clone(&self) -> OverlayRecentDB {
|
fn clone(&self) -> OverlayRecentDB {
|
||||||
OverlayRecentDB {
|
OverlayRecentDB {
|
||||||
transaction_overlay: MemoryDB::new(),
|
transaction_overlay: self.transaction_overlay.clone(),
|
||||||
backing: self.backing.clone(),
|
backing: self.backing.clone(),
|
||||||
journal_overlay: self.journal_overlay.clone(),
|
journal_overlay: self.journal_overlay.clone(),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user