From 81c3ab0cb126809752268527deaa62dcde81fab8 Mon Sep 17 00:00:00 2001 From: 4miners Date: Tue, 2 May 2017 02:22:58 +0200 Subject: [PATCH] Add exception for round 27040 --- helpers/RoundChanges.js | 12 ++++++++++++ helpers/exceptions.js | 3 +++ 2 files changed, 15 insertions(+) diff --git a/helpers/RoundChanges.js b/helpers/RoundChanges.js index bda395ade20..92f41137c16 100644 --- a/helpers/RoundChanges.js +++ b/helpers/RoundChanges.js @@ -2,6 +2,7 @@ var bignum = require('./bignum'); var slots = require('./slots'); +var exceptions = require('./exceptions'); // Constructor function RoundChanges (scope) { @@ -12,6 +13,17 @@ function RoundChanges (scope) { this.roundFees = Math.floor(scope.__private.feesByRound[scope.round]) || 0; this.roundRewards = (scope.__private.rewardsByRound[scope.round] || []); } + + // Apply exception for round if required + if (exceptions.rounds[scope.round]) { + // Apply rewards factor + this.roundRewards.forEach(function (reward, index) { + this.roundRewards[index] = new bignum(reward.toPrecision(15)).times(exceptions.rounds[scope.round].rewards_factor).floor(); + }.bind(this)); + + // Apply fees factor and bonus + this.roundFees = new bignum(this.roundFees.toPrecision(15)).times(exceptions.rounds[scope.round].fees_factor).plus(exceptions.rounds[scope.round].fees_bonus).floor(); + } } // Public methods diff --git a/helpers/exceptions.js b/helpers/exceptions.js index 9c3488c364f..65dbb5f8494 100644 --- a/helpers/exceptions.js +++ b/helpers/exceptions.js @@ -5,6 +5,9 @@ module.exports = { mainnet: 'd121d3abf5425fdc0f161d9ddb32f89b7750b4bdb0bff7d18b191d4b4bafa6d4', testnet: 'c96dec3595ff6041c3bd28b76b8cf75dce8225173d1bd00241624ee89b50f2a8' }, + rounds: { + '27040': {rewards_factor: 2, fees_factor: 2, fees_bonus: 10000000} + }, senderPublicKey: [ '6140297682817553271', // 12526 '17693199811026162972', // 12532