mirror of
https://github.com/mempool/mempool.git
synced 2025-01-18 05:12:35 +01:00
Merge pull request #941 from mempool/simon/hide-early-difficulty-adjustment
Handle recent difficulty adjustment estimate gracefully
This commit is contained in:
commit
5b9ae2eaf5
@ -724,6 +724,7 @@ class Routes {
|
|||||||
const nextRetargetHeight = blockHeight + remainingBlocks;
|
const nextRetargetHeight = blockHeight + remainingBlocks;
|
||||||
|
|
||||||
let difficultyChange = 0;
|
let difficultyChange = 0;
|
||||||
|
if (remainingBlocks < 1870) {
|
||||||
if (blocksInEpoch > 0) {
|
if (blocksInEpoch > 0) {
|
||||||
difficultyChange = (600 / (diff / blocksInEpoch ) - 1) * 100;
|
difficultyChange = (600 / (diff / blocksInEpoch ) - 1) * 100;
|
||||||
}
|
}
|
||||||
@ -733,6 +734,7 @@ class Routes {
|
|||||||
if (difficultyChange < -75) {
|
if (difficultyChange < -75) {
|
||||||
difficultyChange = -75;
|
difficultyChange = -75;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const timeAvgDiff = difficultyChange * 0.1;
|
const timeAvgDiff = difficultyChange * 0.1;
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<h5 class="card-title" i18n="difficulty-box.estimate">Estimate</h5>
|
<h5 class="card-title" i18n="difficulty-box.estimate">Estimate</h5>
|
||||||
<div class="card-text" [ngStyle]="{'color': epochData.colorAdjustments}">
|
<div *ngIf="epochData.remainingBlocks < 1870; else recentlyAdjusted" class="card-text" [ngStyle]="{'color': epochData.colorAdjustments}">
|
||||||
<span *ngIf="epochData.change > 0; else arrowDownDifficulty" >
|
<span *ngIf="epochData.change > 0; else arrowDownDifficulty" >
|
||||||
<fa-icon class="retarget-sign" [icon]="['fas', 'caret-up']" [fixedWidth]="true"></fa-icon>
|
<fa-icon class="retarget-sign" [icon]="['fas', 'caret-up']" [fixedWidth]="true"></fa-icon>
|
||||||
</span>
|
</span>
|
||||||
@ -252,6 +252,9 @@
|
|||||||
{{ epochData.change | absolute | number: '1.2-2' }}
|
{{ epochData.change | absolute | number: '1.2-2' }}
|
||||||
<span class="symbol">%</span>
|
<span class="symbol">%</span>
|
||||||
</div>
|
</div>
|
||||||
|
<ng-template #recentlyAdjusted>
|
||||||
|
<div class="card-text">—</div>
|
||||||
|
</ng-template>
|
||||||
<div class="symbol">
|
<div class="symbol">
|
||||||
<span i18n="difficulty-box.previous">Previous</span>:
|
<span i18n="difficulty-box.previous">Previous</span>:
|
||||||
<span [ngStyle]="{'color': epochData.colorPreviousAdjustments}">
|
<span [ngStyle]="{'color': epochData.colorPreviousAdjustments}">
|
||||||
|
@ -144,6 +144,7 @@ export class DashboardComponent implements OnInit {
|
|||||||
const newDifficultyHeight = block.height + remainingBlocks;
|
const newDifficultyHeight = block.height + remainingBlocks;
|
||||||
|
|
||||||
let change = 0;
|
let change = 0;
|
||||||
|
if (remainingBlocks < 1870) {
|
||||||
if (blocksInEpoch > 0) {
|
if (blocksInEpoch > 0) {
|
||||||
change = (600 / (diff / blocksInEpoch ) - 1) * 100;
|
change = (600 / (diff / blocksInEpoch ) - 1) * 100;
|
||||||
}
|
}
|
||||||
@ -153,6 +154,7 @@ export class DashboardComponent implements OnInit {
|
|||||||
if (change < -75) {
|
if (change < -75) {
|
||||||
change = -75;
|
change = -75;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const timeAvgDiff = change * 0.1;
|
const timeAvgDiff = change * 0.1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user