From ed3090d2e830a1fd8980d411510624d049a76029 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Fri, 12 Apr 2019 11:12:04 -0700 Subject: [PATCH] Enforce founders reward = 0 when block reward goes to zero --- src/komodo_bitcoind.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 117458813..e0eb448d4 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1210,21 +1210,23 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) int32_t i,j,n=0,txn_count,halvings; int64_t nSubsidy; uint64_t commission,total = 0; txn_count = pblock->vtx.size(); - // HUSH prod values - //int32_t starting_commission = 125000000, HALVING1 = 340000, INTERVAL = 840000; - int64_t starting_commission = 125000000, HALVING1 = 340, INTERVAL = 840, TRANSITION = 129; if ( ASSETCHAINS_FOUNDERS != 0 ) { + // prod values + //int32_t starting_commission = 125000000, HALVING1 = 340000, INTERVAL = 840000, TRANSITION = 129, BR_END = 5422111; + // testnet values + int64_t starting_commission = 125000000, HALVING1 = 34, INTERVAL = 84, TRANSITION = 129, 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, "HUSHT3") != 0)) { + + 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 // 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 no FR + // Transition period of 128 blocks has BR=FR=0 if (height < 129) { commission = 0; } else if (height < HALVING1) { @@ -1249,6 +1251,11 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) // HUSH should never hit the 9th halving, but yolo commission = starting_commission / 512; } + + // enforce the end of FR when BR ends + if (height > BR_END) { + commission = 0; + } } fprintf(stderr,"AFTER ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION));