Refactoring removing invalid transactions from queue

This commit is contained in:
Tomasz Drwięga 2016-03-17 15:30:03 +01:00 committed by arkpar
parent 177d26a25e
commit fbc85e31c2

View File

@ -133,19 +133,14 @@ impl MinerService for Miner {
transactions, transactions,
); );
match b { *self.sealing_block.lock().unwrap() = b.map(|(block, invalid_transactions)| {
None => { let mut queue = self.transaction_queue.lock().unwrap();
*self.sealing_block.lock().unwrap() = None queue.remove_all(
}, &invalid_transactions.into_iter().collect::<Vec<H256>>(),
Some((block, invalid_transactions)) => { |a: &Address| chain.nonce(a)
let mut queue = self.transaction_queue.lock().unwrap(); );
queue.remove_all( block
&invalid_transactions.into_iter().collect::<Vec<H256>>(), });
|a: &Address| chain.nonce(a)
);
*self.sealing_block.lock().unwrap() = Some(block)
}
}
} }
fn sealing_block(&self, chain: &BlockChainClient) -> &Mutex<Option<ClosedBlock>> { fn sealing_block(&self, chain: &BlockChainClient) -> &Mutex<Option<ClosedBlock>> {