From e12645a0f012c4a3afe99f485740346cbf8ae87a Mon Sep 17 00:00:00 2001 From: miketout Date: Sun, 18 Nov 2018 17:24:06 -0800 Subject: [PATCH] Fix problem in calculating max_money when there is no halving --- src/komodo_globals.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 2fb81e8e9..6f4f3e476 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -159,9 +159,14 @@ int64_t komodo_current_supply(uint32_t nHeight) uint32_t modulo = (curEnd - lastEnd) % period; uint64_t decay = ASSETCHAINS_DECAY[j]; + if (!period) + { + // no halving, straight multiply + cur_money += reward * (nHeight - 1); + } // if exactly SATOSHIDEN, linear decay to zero or to next era, same as: // (next_era_reward + (starting reward - next_era_reward) / 2) * num_blocks - if ( decay == SATOSHIDEN ) + else if ( decay == SATOSHIDEN ) { int64_t lowestSubsidy, subsidyDifference, stepDifference, stepTriangle; int64_t denominator, modulo;