Merge branch 'master' of github.com:ethcore/parity into jsonrpc

This commit is contained in:
debris
2016-02-08 11:59:03 +01:00
5 changed files with 78 additions and 38 deletions

View File

@@ -205,6 +205,8 @@ impl BlockQueue {
let mut verification = self.verification.lock().unwrap();
verification.unverified.clear();
verification.verifying.clear();
verification.verified.clear();
self.processing.write().unwrap().clear();
}
/// Wait for queue to be empty

View File

@@ -67,7 +67,6 @@ impl fmt::Display for BlockChainInfo {
}
}
/// Blockchain database client. Owns and manages a blockchain and a block queue.
pub trait BlockChainClient : Sync + Send {
/// Get raw block header data by block header hash.
@@ -158,8 +157,7 @@ impl ClientReport {
pub struct Client {
chain: Arc<RwLock<BlockChain>>,
engine: Arc<Box<Engine>>,
state_db: Arc<DB>,
state_journal: Mutex<JournalDB>,
state_db: Mutex<JournalDB>,
block_queue: RwLock<BlockQueue>,
report: RwLock<ClientReport>,
import_lock: Mutex<()>
@@ -212,8 +210,7 @@ impl Client {
Ok(Arc::new(Client {
chain: chain,
engine: engine.clone(),
state_db: db.clone(),
state_journal: Mutex::new(JournalDB::new_with_arc(db)),
state_db: Mutex::new(state_db),
block_queue: RwLock::new(BlockQueue::new(engine, message_channel)),
report: RwLock::new(Default::default()),
import_lock: Mutex::new(()),
@@ -268,7 +265,7 @@ impl Client {
}
}
let db = self.state_journal.lock().unwrap().clone();
let db = self.state_db.lock().unwrap().clone();
let result = match enact_verified(&block, self.engine.deref().deref(), db, &parent, &last_hashes) {
Ok(b) => b,
Err(e) => {
@@ -305,7 +302,7 @@ impl Client {
/// Get a copy of the best block's state.
pub fn state(&self) -> State {
State::from_existing(JournalDB::new_with_arc(self.state_db.clone()), HeaderView::new(&self.best_block_header()).state_root(), self.engine.account_start_nonce())
State::from_existing(self.state_db.lock().unwrap().clone(), HeaderView::new(&self.best_block_header()).state_root(), self.engine.account_start_nonce())
}
/// Get info on the cache.