Stop using eras and hardcode HUSH subsidy/FR

This commit is contained in:
Jonathan "Duke" Leto
2019-04-12 20:23:04 -07:00
parent 7ce2189cfe
commit 30643f4994
3 changed files with 41 additions and 110 deletions

View File

@@ -1215,15 +1215,14 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
// prod values
//int32_t starting_commission = 125000000, HALVING1 = 340000, INTERVAL = 840000, TRANSITION = 129, BR_END = 5422111;
// testnet values
int64_t starting_commission = 125000000, HALVING1 = 142, INTERVAL = 84, TRANSITION = 29, BR_END = 500;
int64_t starting_commission = 125000000, HALVING1 = 34, INTERVAL = 84, TRANSITION = 29, BR_END = 500;
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN);
fprintf(stderr,"ORIG ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION));
if ((strcmp(ASSETCHAINS_SYMBOL, "HUSH") != 0) || (strcmp(ASSETCHAINS_SYMBOL, "HUSHT4") != 0)) {
// 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
if ((strcmp(ASSETCHAINS_SYMBOL, "HUSH") != 0) || (strcmp(ASSETCHAINS_SYMBOL, "HUSHT5") != 0)) {
// HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it manually
// 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
// Transition period of 128 blocks has BR=FR=0
@@ -1241,15 +1240,13 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
commission = starting_commission / 16;
} else if (height < HALVING1+5*INTERVAL) {
commission = starting_commission / 32;
} else if (height < HALVING1+6*INTERVAL) {
} else if (height < HALVING1+6*INTERVAL) { // Block 5380000
// Block reward will go to zero between 7th+8th halvings
commission = starting_commission / 64;
} else if (height < HALVING1+7*INTERVAL) {
} else if (height < HALVING1+7*INTERVAL) { // Block 6220000
commission = starting_commission / 128;
} else if (height < HALVING1+8*INTERVAL) {
} else if (height < HALVING1+8*INTERVAL) { // Block 7060000
commission = starting_commission / 256;
} else if (height < HALVING1+9*INTERVAL) {
// HUSH should never hit the 9th halving, but yolo
commission = starting_commission / 512;
}
// enforce the end of FR when BR ends