simplify if statement

This commit is contained in:
Antoni Spaanderman 2022-03-09 11:51:36 +01:00
parent 95b8a77bf1
commit 40804b3426

View File

@ -268,7 +268,7 @@ class Blocks {
this.lastDifficultyAdjustmentTime = block.timestamp;
this.currentDifficulty = block.difficulty;
if (blockHeightTip - heightDiff - 2016 >= 0) {
if (blockHeightTip >= 2016) {
const previousPeriodBlockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff - 2016);
const previousPeriodBlock = await bitcoinApi.$getBlock(previousPeriodBlockHash);
this.previousDifficultyRetarget = (block.difficulty - previousPeriodBlock.difficulty) / previousPeriodBlock.difficulty * 100;