Add difficulty adjustment in mining page + Fix pools table on mobile

This commit is contained in:
nymkappa
2022-01-17 15:34:34 +09:00
parent 091027cc79
commit b9a047b22d
9 changed files with 63 additions and 20 deletions

View File

@@ -14,6 +14,8 @@ interface EpochProgress {
timeAvg: string;
remainingTime: number;
previousRetarget: number;
blocksUntilHalving: number;
timeUntilHalving: number;
}
@Component({
@@ -26,6 +28,9 @@ export class DifficultyComponent implements OnInit {
isLoadingWebSocket$: Observable<boolean>;
difficultyEpoch$: Observable<EpochProgress>;
@Input() showProgress: boolean = true;
@Input() showHalving: boolean = false;
constructor(
public stateService: StateService,
) { }
@@ -92,6 +97,9 @@ export class DifficultyComponent implements OnInit {
colorPreviousAdjustments = '#ffffff66';
}
const blocksUntilHalving = block.height % 210000;
const timeUntilHalving = (blocksUntilHalving * timeAvgMins * 60 * 1000) + (now * 1000);
return {
base: `${progress}%`,
change,
@@ -104,6 +112,8 @@ export class DifficultyComponent implements OnInit {
newDifficultyHeight,
remainingTime,
previousRetarget,
blocksUntilHalving,
timeUntilHalving,
};
})
);