mirror of
https://github.com/mempool/mempool.git
synced 2024-11-20 10:21:52 +01:00
simplify if statement
This commit is contained in:
parent
b2f9c7db2d
commit
8d42b38234
@ -268,7 +268,7 @@ class Blocks {
|
|||||||
this.lastDifficultyAdjustmentTime = block.timestamp;
|
this.lastDifficultyAdjustmentTime = block.timestamp;
|
||||||
this.currentDifficulty = block.difficulty;
|
this.currentDifficulty = block.difficulty;
|
||||||
|
|
||||||
if (blockHeightTip - heightDiff - 2016 >= 0) {
|
if (blockHeightTip >= 2016) {
|
||||||
const previousPeriodBlockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff - 2016);
|
const previousPeriodBlockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff - 2016);
|
||||||
const previousPeriodBlock = await bitcoinApi.$getBlock(previousPeriodBlockHash);
|
const previousPeriodBlock = await bitcoinApi.$getBlock(previousPeriodBlockHash);
|
||||||
this.previousDifficultyRetarget = (block.difficulty - previousPeriodBlock.difficulty) / previousPeriodBlock.difficulty * 100;
|
this.previousDifficultyRetarget = (block.difficulty - previousPeriodBlock.difficulty) / previousPeriodBlock.difficulty * 100;
|
||||||
|
Loading…
Reference in New Issue
Block a user