Skip to content

Commit

Permalink
Hardcode in checks for block 0 and block 1 since they are special
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
alexlyp committed Feb 25, 2016
1 parent 8a58c40 commit 6d50513
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions lib/Rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6d50513

Please sign in to comment.