This commit is contained in:
jl777
2018-02-13 21:37:32 +02:00
parent 53a94b280d
commit 6e94384f91
2 changed files with 13 additions and 5 deletions

View File

@@ -1548,10 +1548,10 @@ void komodo_args(char *argv0)
ASSETCHAINS_DECAY = GetArg("-ac_decay",0);
ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0);
ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey","");
if ( ASSETCHAINS_HALVING != 0 && ASSETCHAINS_HALVING < 10000 )
if ( ASSETCHAINS_HALVING != 0 && ASSETCHAINS_HALVING < 1440 )
{
ASSETCHAINS_HALVING = 10000;
printf("ASSETCHAINS_HALVING must be at least 10000 blocks\n");
ASSETCHAINS_HALVING = 1440;
printf("ASSETCHAINS_HALVING must be at least 1440 blocks\n");
}
if ( ASSETCHAINS_DECAY == 100000000 && ASSETCHAINS_ENDSUBSIDY == 0 )
{

View File

@@ -1497,6 +1497,7 @@ extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,AS
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
static uint64_t cached_subsidy; static int32_t cached_numhalvings;
int32_t numhalvings,i; uint64_t numerator; CAmount nSubsidy = 3 * COIN;
if ( ASSETCHAINS_SYMBOL[0] == 0 )
{
@@ -1534,8 +1535,15 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
}
else
{
for (i=0; i<numhalvings&&nSubsidy!=0; i++)
nSubsidy = (nSubsidy * ASSETCHAINS_DECAY) / 100000000;
if ( cached_subsidy > 0 && cached_numhalvings == numhalvings )
nSubsidy = cached_subsidy;
else
{
for (i=0; i<numhalvings&&nSubsidy!=0; i++)
nSubsidy = (nSubsidy * ASSETCHAINS_DECAY) / 100000000;
cached_subsidy = nSubsidy;
cached_numhalvings = numhalvings;
}
}
}
}