mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-24 08:31:20 +00:00
Refactor functions
This commit is contained in:
parent
479ebefd63
commit
4afac86b66
@ -183,7 +183,7 @@ export const countReward = (
|
||||
nodeStatus,
|
||||
tier4Online: number
|
||||
): number => {
|
||||
if (accountInfo != null) {
|
||||
if (accountInfo != null && (addressLevel && addressLevel.length > 0) ) {
|
||||
const level = accountInfo.level;
|
||||
if (level === 0) {
|
||||
return 0;
|
||||
@ -273,7 +273,7 @@ export const countRewardDay = (
|
||||
nodeStatus,
|
||||
tier4Online: number
|
||||
): number => {
|
||||
if (accountInfo != null) {
|
||||
if (accountInfo != null && (addressLevel && addressLevel.length > 0) ) {
|
||||
const level = accountInfo.level;
|
||||
const timeCalc = averageBlockDay(adminInfo, nodeHeightBlock);
|
||||
if (level === 0) {
|
||||
@ -426,11 +426,12 @@ export const levelUpBlocks = (accountInfo, nodeStatus): number => {
|
||||
)
|
||||
return 0;
|
||||
|
||||
const nextBatch = 1000 - (nodeStatus.height % 1000);
|
||||
const countBlocks =
|
||||
accountTargetBlocks(accountInfo?.level)! -
|
||||
(accountInfo?.blocksMinted + accountInfo?.blocksMintedAdjustment);
|
||||
|
||||
return countBlocks;
|
||||
(accountInfo?.blocksMinted + accountInfo?.blocksMintedAdjustment) + 1000;
|
||||
const countBlocksActual = countBlocks + nextBatch - (countBlocks % 1000);
|
||||
return countBlocksActual;
|
||||
};
|
||||
|
||||
export const levelUpDays = (
|
||||
@ -446,11 +447,13 @@ export const levelUpDays = (
|
||||
)
|
||||
return undefined;
|
||||
|
||||
const nextBatch = 1000 - (nodeStatus.height % 1000);
|
||||
const countBlocks =
|
||||
accountTargetBlocks(accountInfo?.level)! -
|
||||
(accountInfo?.blocksMinted + accountInfo?.blocksMintedAdjustment);
|
||||
(accountInfo?.blocksMinted + accountInfo?.blocksMintedAdjustment) + 1000;
|
||||
|
||||
const countDays = countBlocks / averageBlockDay(adminInfo, nodeHeightBlock);
|
||||
const countBlocksActual = countBlocks + nextBatch - (countBlocks % 1000);
|
||||
const countDays = countBlocksActual / averageBlockDay(adminInfo, nodeHeightBlock);
|
||||
return countDays;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user