From 16efbff11a7cae11be9466a506c121fc09db1356 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 2 Mar 2019 02:55:51 -1100 Subject: [PATCH] Billion at a time --- src/komodo_globals.h | 2 ++ src/komodo_utils.h | 13 +++++++++++-- src/main.cpp | 6 +++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 7370e8c70..551a61704 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -266,6 +266,8 @@ uint64_t komodo_current_supply(uint32_t nHeight) } #define KOMODO_MAXNVALUE (((uint64_t)1 << 63) - 1) #define KOMODO_BIT63SET(x) ((x) & ((uint64_t)1 << 63)) +#define KOMODO_VALUETOOBIG(x) ((x) > (uint64_t)10000000000) + if ( KOMODO_BIT63SET(cur_money) != 0 ) return(KOMODO_MAXNVALUE); if ( ASSETCHAINS_COMMISSION != 0 ) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 3b7d06401..4086af94c 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1639,9 +1639,18 @@ uint64_t komodo_ac_block_subsidy(int nHeight) } } } - if ( nHeight == 1 ) + uint32_t magicExtra = ASSETCHAINS_STAKED ? ASSETCHAINS_MAGIC : (ASSETCHAINS_MAGIC & 0xffffff); + if ( ASSETCHAINS_SUPPLY > 1000000000 ) + { + if ( nHeight <= ASSETCHAINS_SUPPLY/1000000000 ) + { + subsidy = (uint64_t)1000000000 * COIN; + if ( nHeight == 1 ) + subsidy += magicExtra; + } + } + else if ( nHeight == 1 ) { - uint32_t magicExtra = ASSETCHAINS_STAKED ? ASSETCHAINS_MAGIC : (ASSETCHAINS_MAGIC & 0xffffff); if ( ASSETCHAINS_LASTERA == 0 ) subsidy = ASSETCHAINS_SUPPLY * SATOSHIDEN + magicExtra; else diff --git a/src/main.cpp b/src/main.cpp index 1b88aecf7..603ad054c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1808,7 +1808,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa CAmount nValueOut = tx.GetValueOut(); CAmount nFees = nValueIn-nValueOut; double dPriority = view.GetPriority(tx, chainActive.Height()); - if ( KOMODO_BIT63SET(nValueOut) != 0 ) + if ( KOMODO_VALUETOOBIG(nValueOut) != 0 ) return state.DoS(100, error("AcceptToMemoryPool: GetValueOut too big"),REJECT_INVALID,"tx valueout is too big"); // Keep track of transactions that spend a coinbase, which we re-scan @@ -3494,11 +3494,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin txdata.emplace_back(tx); valueout = tx.GetValueOut(); - if ( KOMODO_BIT63SET(valueout) != 0 ) + if ( KOMODO_VALUETOOBIG(valueout) != 0 ) return state.DoS(100, error("ConnectBlock(): GetValueOut too big"),REJECT_INVALID,"tx valueout is too big"); prevsum = voutsum; voutsum += valueout; - if ( KOMODO_BIT63SET(voutsum) != 0 ) + if ( KOMODO_VALUETOOBIG(voutsum) != 0 ) { fprintf(stderr,"voutsum %.8f too big\n",(double)voutsum/COIN); return state.DoS(100, error("ConnectBlock(): voutsum too big"),REJECT_INVALID,"tx valueout is too big");