Refactoring removing invalid transactions from queue

This commit is contained in:
Tomasz Drwięga 2016-03-17 15:30:03 +01:00
parent c4021a77ca
commit fece330ca4

View File

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