Fixing miner deadlock (#1885)
This commit is contained in:
parent
ab8b763ea5
commit
73c19fd4b5
@ -168,12 +168,11 @@ pub struct Miner {
|
|||||||
// NOTE [ToDr] When locking always lock in this order!
|
// NOTE [ToDr] When locking always lock in this order!
|
||||||
transaction_queue: Arc<Mutex<TransactionQueue>>,
|
transaction_queue: Arc<Mutex<TransactionQueue>>,
|
||||||
sealing_work: Mutex<SealingWork>,
|
sealing_work: Mutex<SealingWork>,
|
||||||
|
next_allowed_reseal: Mutex<Instant>,
|
||||||
|
sealing_block_last_request: Mutex<u64>,
|
||||||
// for sealing...
|
// for sealing...
|
||||||
options: MinerOptions,
|
options: MinerOptions,
|
||||||
|
|
||||||
next_allowed_reseal: Mutex<Instant>,
|
|
||||||
sealing_block_last_request: Mutex<u64>,
|
|
||||||
gas_range_target: RwLock<(U256, U256)>,
|
gas_range_target: RwLock<(U256, U256)>,
|
||||||
author: RwLock<Address>,
|
author: RwLock<Address>,
|
||||||
extra_data: RwLock<Bytes>,
|
extra_data: RwLock<Bytes>,
|
||||||
@ -736,11 +735,11 @@ impl MinerService for Miner {
|
|||||||
fn update_sealing(&self, chain: &MiningBlockChainClient) {
|
fn update_sealing(&self, chain: &MiningBlockChainClient) {
|
||||||
trace!(target: "miner", "update_sealing");
|
trace!(target: "miner", "update_sealing");
|
||||||
let requires_reseal = {
|
let requires_reseal = {
|
||||||
|
let has_local_transactions = self.transaction_queue.lock().has_local_pending_transactions();
|
||||||
let mut sealing_work = self.sealing_work.lock();
|
let mut sealing_work = self.sealing_work.lock();
|
||||||
if sealing_work.enabled {
|
if sealing_work.enabled {
|
||||||
trace!(target: "miner", "update_sealing: sealing enabled");
|
trace!(target: "miner", "update_sealing: sealing enabled");
|
||||||
let current_no = chain.chain_info().best_block_number;
|
let current_no = chain.chain_info().best_block_number;
|
||||||
let has_local_transactions = self.transaction_queue.lock().has_local_pending_transactions();
|
|
||||||
let last_request = *self.sealing_block_last_request.lock();
|
let last_request = *self.sealing_block_last_request.lock();
|
||||||
let should_disable_sealing = !self.forced_sealing()
|
let should_disable_sealing = !self.forced_sealing()
|
||||||
&& !has_local_transactions
|
&& !has_local_transactions
|
||||||
|
Loading…
Reference in New Issue
Block a user