|
|
@ -1238,27 +1238,14 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams); |
|
|
|
// 10% of all block rewards go towards Hush core team
|
|
|
|
// If you do not like this, you are encouraged to fork the chain
|
|
|
|
// or start your own Hush Smart Chain: https://github.com/myhush/hush-smart-chains
|
|
|
|
uint64_t komodo_commission(const CBlock *pblock,int32_t height) |
|
|
|
{ |
|
|
|
fprintf(stderr,"%s at height=%d\n",__func__,height); |
|
|
|
static bool didinit = false, ishush3 = false; |
|
|
|
|
|
|
|
if (!didinit) { |
|
|
|
ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false; |
|
|
|
didinit = true; |
|
|
|
fprintf(stderr,"%s: didinit ishush3=%d\n", __func__, ishush3); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0; |
|
|
|
if ( ASSETCHAINS_FOUNDERS != 0 ) |
|
|
|
{ |
|
|
|
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus()); |
|
|
|
fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION)); |
|
|
|
commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN); |
|
|
|
|
|
|
|
// HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves.
|
|
|
|
// You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25
|
|
|
|
// but to tell the AC params, I need to say "11% of 11.25" is 1.25
|
|
|
|
// 11% ie. 1/9th cannot be exactly represented and so the FR has tiny amounts of error unless done manually
|
|
|
|
// Do not change this code unless you really know what you are doing.
|
|
|
|
// Here Be Dragons! -- Duke Leto
|
|
|
|
if (ishush3) { |
|
|
|
uint64_t hush_commission(int height) |
|
|
|
{ |
|
|
|
// TODO: Calculate new BR_END based on 75s block time!!! 2X old BR_END is a rough estimate, not exact!
|
|
|
|
int32_t starting_commission = 125000000, HALVING1 = GetArg("-z2zheight",340000), |
|
|
|
INTERVAL = GetArg("-ac_halving1",840000), TRANSITION = 129, BR_END = 2*5422111; |
|
|
@ -1269,10 +1256,7 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) |
|
|
|
// they should be because exact values are not integers, causing
|
|
|
|
// slightly less coins to be actually mined
|
|
|
|
}; |
|
|
|
// HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves.
|
|
|
|
// You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25
|
|
|
|
// but to tell the AC params, I need to say "11% of 11.25" is 1.25
|
|
|
|
// 11% ie. 1/9th cannot be exactly represented and so the FR has tiny amounts of error unless done manually
|
|
|
|
uint64_t commission = 0; |
|
|
|
|
|
|
|
if( height > HALVING1) { |
|
|
|
// Block time going from 150s to 75s (half) means the interval between halvings
|
|
|
@ -1280,6 +1264,7 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) |
|
|
|
// With 150s blocks, we have 210,000 blocks per year
|
|
|
|
// With 75s blocks, we have 420,000 blocks per year
|
|
|
|
INTERVAL = GetArg("-ac_halving2",1680000); |
|
|
|
fprintf(stderr,"%s: height=%d increasing interval to %d\n", __func__, height, INTERVAL); |
|
|
|
} |
|
|
|
|
|
|
|
// Transition period of 128 blocks has BR=FR=0
|
|
|
@ -1310,24 +1295,50 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) |
|
|
|
// BR_END is the block with the last non-zero block reward, which overrides
|
|
|
|
// the -ac_end param on HUSH3
|
|
|
|
if(height > BR_END) { |
|
|
|
fprintf(stderr,"%s: HUSH block reward has gone to zero at height %d!!! It was a good run folks\n", __func__, height); |
|
|
|
commission = 0; |
|
|
|
} |
|
|
|
fprintf(stderr,"%s: commission=%lu,interval=%d at height %d\n", __func__, commission, INTERVAL, height); |
|
|
|
return commission; |
|
|
|
} |
|
|
|
|
|
|
|
uint64_t komodo_commission(const CBlock *pblock,int32_t height) |
|
|
|
{ |
|
|
|
fprintf(stderr,"%s at height=%d\n",__func__,height); |
|
|
|
static bool didinit = false, ishush3 = false; |
|
|
|
|
|
|
|
if (!didinit) { |
|
|
|
ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false; |
|
|
|
didinit = true; |
|
|
|
fprintf(stderr,"%s: didinit ishush3=%d\n", __func__, ishush3); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0; |
|
|
|
if ( ASSETCHAINS_FOUNDERS != 0 ) |
|
|
|
{ |
|
|
|
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus()); |
|
|
|
fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION)); |
|
|
|
commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN); |
|
|
|
|
|
|
|
if (ishush3) { |
|
|
|
commission = hush_commission(height); |
|
|
|
} |
|
|
|
|
|
|
|
if ( ASSETCHAINS_FOUNDERS > 1 ) |
|
|
|
{ |
|
|
|
if ( (height % ASSETCHAINS_FOUNDERS) == 0 ) |
|
|
|
{ |
|
|
|
if ( ASSETCHAINS_FOUNDERS_REWARD == 0 ) |
|
|
|
if ( ASSETCHAINS_FOUNDERS_REWARD == 0 ) { |
|
|
|
commission = commission * ASSETCHAINS_FOUNDERS; |
|
|
|
else |
|
|
|
} else { |
|
|
|
commission = ASSETCHAINS_FOUNDERS_REWARD; |
|
|
|
} |
|
|
|
else commission = 0; |
|
|
|
fprintf(stderr,"%s: set commission=%lu at height %d with\n",__func__,commission, height); |
|
|
|
} else { |
|
|
|
commission = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
else if ( pblock != 0 ) |
|
|
|
{ |
|
|
|
} else if ( pblock != 0 ) { |
|
|
|
txn_count = pblock->vtx.size(); |
|
|
|
for (i=0; i<txn_count; i++) |
|
|
|
{ |
|
|
|