Refactoring removing invalid transactions from queue
This commit is contained in:
parent
c4021a77ca
commit
fece330ca4
@ -133,19 +133,14 @@ impl MinerService for Miner {
|
|||||||
transactions,
|
transactions,
|
||||||
);
|
);
|
||||||
|
|
||||||
match b {
|
*self.sealing_block.lock().unwrap() = b.map(|(block, invalid_transactions)| {
|
||||||
None => {
|
|
||||||
*self.sealing_block.lock().unwrap() = None
|
|
||||||
},
|
|
||||||
Some((block, invalid_transactions)) => {
|
|
||||||
let mut queue = self.transaction_queue.lock().unwrap();
|
let mut queue = self.transaction_queue.lock().unwrap();
|
||||||
queue.remove_all(
|
queue.remove_all(
|
||||||
&invalid_transactions.into_iter().collect::<Vec<H256>>(),
|
&invalid_transactions.into_iter().collect::<Vec<H256>>(),
|
||||||
|a: &Address| chain.nonce(a)
|
|a: &Address| chain.nonce(a)
|
||||||
);
|
);
|
||||||
*self.sealing_block.lock().unwrap() = Some(block)
|
block
|
||||||
}
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sealing_block(&self, chain: &BlockChainClient) -> &Mutex<Option<ClosedBlock>> {
|
fn sealing_block(&self, chain: &BlockChainClient) -> &Mutex<Option<ClosedBlock>> {
|
||||||
|
Loading…
Reference in New Issue
Block a user