From ef10c6f6377955bbc709755632f21f5cb0451124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Sun, 20 Mar 2016 12:18:41 +0100 Subject: [PATCH] Avoiding possible overflow when block number gets smaller. --- miner/src/miner.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/miner/src/miner.rs b/miner/src/miner.rs index 699848337..e1b314d57 100644 --- a/miner/src/miner.rs +++ b/miner/src/miner.rs @@ -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 {