Created
March 2, 2014 03:44
-
-
Save anonymous/9301585 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
static const int64_t COIN = 100000000; | |
static const int nSubsidyHalvingInterval = 210000; | |
int64_t GetBlockValue(int nHeight,int interval, int64_t nFees) | |
{ | |
int64_t nSubsidy = 50 * COIN; | |
nSubsidy >>= (nHeight / interval); | |
return nSubsidy + nFees; | |
} | |
int main() | |
{ | |
int64_t pval = 0; | |
for (int i=0;i<INT_MAX;i++) { | |
int64_t val = GetBlockValue(i,nSubsidyHalvingInterval,0); | |
if (val!=pval) { | |
cout << i << " switch from " << pval << " to " << val << endl; | |
pval = val; | |
} | |
} | |
return 0; | |
} | |
clang -lstdc++ test.cpp ; ./a.out | |
0 switch from 0 to 5000000000 | |
210000 switch from 5000000000 to 2500000000 | |
420000 switch from 2500000000 to 1250000000 | |
630000 switch from 1250000000 to 625000000 | |
840000 switch from 625000000 to 312500000 | |
1050000 switch from 312500000 to 156250000 | |
1260000 switch from 156250000 to 78125000 | |
1470000 switch from 78125000 to 39062500 | |
1680000 switch from 39062500 to 19531250 | |
1890000 switch from 19531250 to 9765625 | |
2100000 switch from 9765625 to 4882812 | |
2310000 switch from 4882812 to 2441406 | |
2520000 switch from 2441406 to 1220703 | |
2730000 switch from 1220703 to 610351 | |
2940000 switch from 610351 to 305175 | |
3150000 switch from 305175 to 152587 | |
3360000 switch from 152587 to 76293 | |
3570000 switch from 76293 to 38146 | |
3780000 switch from 38146 to 19073 | |
3990000 switch from 19073 to 9536 | |
4200000 switch from 9536 to 4768 | |
4410000 switch from 4768 to 2384 | |
4620000 switch from 2384 to 1192 | |
4830000 switch from 1192 to 596 | |
5040000 switch from 596 to 298 | |
5250000 switch from 298 to 149 | |
5460000 switch from 149 to 74 | |
5670000 switch from 74 to 37 | |
5880000 switch from 37 to 18 | |
6090000 switch from 18 to 9 | |
6300000 switch from 9 to 4 | |
6510000 switch from 4 to 2 | |
6720000 switch from 2 to 1 | |
6930000 switch from 1 to 0 | |
13440000 switch from 0 to 5000000000 | |
13650000 switch from 5000000000 to 2500000000 | |
13860000 switch from 2500000000 to 1250000000 | |
14070000 switch from 1250000000 to 625000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment