Propagate trie errors upwards from State (#4655)

* state backend trait mirroring state_db API

* minimal state backend trait

make state module public

* fix json tests

* return errors on database corruption

* fix tests, json tests

* fix remainder of build

* add Backend bound on state
This commit is contained in:
Robert Habermeier
2017-02-26 13:10:50 +01:00
committed by Gav Wood
parent eb9ee35d6c
commit 1bf2b27708
27 changed files with 598 additions and 456 deletions

View File

@@ -291,7 +291,7 @@ fn change_history_size() {
for _ in 0..20 {
let mut b = client.prepare_open_block(Address::default(), (3141562.into(), 31415620.into()), vec![]);
b.block_mut().fields_mut().state.add_balance(&address, &5.into(), CleanupMode::NoEmpty);
b.block_mut().fields_mut().state.add_balance(&address, &5.into(), CleanupMode::NoEmpty).unwrap();
b.block_mut().fields_mut().state.commit().unwrap();
let b = b.close_and_lock().seal(&*test_spec.engine, vec![]).unwrap();
client.import_sealed_block(b).unwrap(); // account change is in the journal overlay
@@ -306,7 +306,7 @@ fn change_history_size() {
Arc::new(Miner::with_spec(&test_spec)),
IoChannel::disconnected(),
).unwrap();
assert_eq!(client.state().balance(&address), 100.into());
assert_eq!(client.state().balance(&address).unwrap(), 100.into());
}
#[test]