simplify if statement

This commit is contained in:
Antoni Spaanderman
2022-03-09 11:51:36 +01:00
parent b2f9c7db2d
commit 8d42b38234

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;