From 6d505135e5bb2d397f9cc72802d1cf425145b377 Mon Sep 17 00:00:00 2001 From: Alex Yocom-Piatt Date: Wed, 24 Feb 2016 23:19:58 +0000 Subject: [PATCH] Hardcode in checks for block 0 and block 1 since they are special If version = 0 then use testnet params, and for version = 1 use mainnet. Then check for blocks 0 and 1. Block 0 should show no reward. Block 1 should show the total premine value (100000 for testnet, 1680000 for mainnet) --- lib/Rpc.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/Rpc.js b/lib/Rpc.js index b1406ae22..b2842e0fe 100644 --- a/lib/Rpc.js +++ b/lib/Rpc.js @@ -121,10 +121,27 @@ Rpc.getBlock = function(hash, cb) { var tax = base * taxProportion / 10 * votersProportion; // If block height is below mainnet voting height, leave out stake - if (info.result.height < 4096) { - info.result.reward = Math.round(work + tax) / bitcore.util.COIN; - } else { - info.result.reward = Math.round(work + stake + tax) / bitcore.util.COIN; + // If block height is below mainnet voting height, leave out stake + if (info.result.version == 0) { + if (info.result.height == 0) { + info.result.reward = 0; + } else if (info.result.height == 1) { + info.result.reward = 100000; + } else if (info.result.height < 768) { + info.result.reward = Math.round(work + tax) / bitcore.util.COIN; + } else { + info.result.reward = Math.round(work + stake + tax) / bitcore.util.COIN; + } + } else if (info.result.version == 1) { + if (info.result.height == 0) { + info.result.reward = 0; + } else if (info.result.height == 1) { + info.result.reward = 1680000; + } else if (info.result.height < 4096) { + info.result.reward = Math.round(work + tax) / bitcore.util.COIN; + } else { + info.result.reward = Math.round(work + stake + tax) / bitcore.util.COIN; + } } } return cb(err,info.result);