Avoiding possible overflow when block number gets smaller.

This commit is contained in:
Tomasz Drwięga 2016-03-20 12:18:41 +01:00
parent 40fc3dc060
commit ef10c6f637

View File

@ -161,8 +161,8 @@ impl MinerService for Miner {
let should_disable_sealing = {
let current_no = chain.chain_info().best_block_number;
let last_request = self.sealing_block_last_request.lock().unwrap();
current_no - *last_request > SEALING_TIMEOUT_IN_BLOCKS
let is_greater = current_no > *last_request;
is_greater && current_no - *last_request > SEALING_TIMEOUT_IN_BLOCKS
};
if should_disable_sealing {