From 74b2d99bc624bee53cd538070b5c8d29d9269895 Mon Sep 17 00:00:00 2001 From: KarthiKeyanZ Date: Mon, 26 Jun 2023 13:06:36 +0530 Subject: [PATCH] coin existence calculation changes --- server/utils/common.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/utils/common.ts b/server/utils/common.ts index a10857c..a02cf11 100644 --- a/server/utils/common.ts +++ b/server/utils/common.ts @@ -92,7 +92,7 @@ const getTotalRewardByHeight= async(height) => { currentReward = 4; } else if (height <= BLOCK_ERA_4) { remaining_height = height - BLOCK_ERA_3; - coin_existence = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + (4 * BLOCK_ERA_3) + 2 * remaining_height; + coin_existence = (16 * BLOCK_ERA_1) + (8 * (BLOCK_ERA_2 - BLOCK_ERA_1)) + (4 * (BLOCK_ERA_3 - BLOCK_ERA_2)) + 2 * remaining_height; currentReward = 2; } else if (height <= BLOCK_ERA_5) { remaining_height = height - BLOCK_ERA_4; @@ -300,7 +300,7 @@ const latestBlockDetails = async()=> { currentReward = 4; } else if (height <= BLOCK_ERA_4) { remaining_height = height - BLOCK_ERA_3; - coin_existence = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + (4 * BLOCK_ERA_3) + 2 * remaining_height; + coin_existence = (16 * BLOCK_ERA_1) + (8 * (BLOCK_ERA_2 - BLOCK_ERA_1)) + (4 * (BLOCK_ERA_3 - BLOCK_ERA_2)) + 2 * remaining_height; currentReward = 2; } else if (height <= BLOCK_ERA_5) { remaining_height = height - BLOCK_ERA_4; @@ -516,7 +516,7 @@ const previousBlockDetails = async() => { currentReward = 4; } else if (height <= BLOCK_ERA_4) { remaining_height = height - BLOCK_ERA_3; - coin_existence = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + (4 * BLOCK_ERA_3) + 2 * remaining_height; + coin_existence = (16 * BLOCK_ERA_1) + (8 * (BLOCK_ERA_2 - BLOCK_ERA_1)) + (4 * (BLOCK_ERA_3 - BLOCK_ERA_2)) + 2 * remaining_height; currentReward = 2; } else if (height <= BLOCK_ERA_5) { remaining_height = height - BLOCK_ERA_4;