From 3a02f67bf37ca6c0d08d404cbcbf819a11f2e36f Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 13 Sep 2016 15:04:42 -0300 Subject: [PATCH] coin supply, rewards --- src/amount.h | 2 +- src/main.cpp | 11 ++++++----- src/main.h | 2 +- src/miner.cpp | 4 ++-- src/rpcmining.cpp | 6 +++--- src/test/compress_tests.cpp | 2 +- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/amount.h b/src/amount.h index 9212244a8..520c55a84 100644 --- a/src/amount.h +++ b/src/amount.h @@ -17,7 +17,7 @@ static const CAmount COIN = 100000000; static const CAmount CENT = 1000000; /** No amount larger than this (in satoshi) is valid */ -static const CAmount MAX_MONEY = 21000000 * COIN; +static const CAmount MAX_MONEY = 200000000 * COIN; inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } /** Type-safe wrapper class to for fee rates diff --git a/src/main.cpp b/src/main.cpp index 082456af2..ded9a6cc9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1367,8 +1367,8 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex) CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { - CAmount nSubsidy = 12.5 * COIN; - + CAmount nSubsidy = 3 * COIN; +/* // Mining slow start // The subsidy is ramped up linearly, skipping the middle payout of // MAX_SUBSIDY/2 to keep the monetary curve consistent with no slow start. @@ -1383,8 +1383,9 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) } assert(nHeight > consensusParams.SubsidySlowStartShift()); - int halvings = (nHeight - consensusParams.SubsidySlowStartShift()) / consensusParams.nSubsidyHalvingInterval; + int halvings = (nHeight - consensusParams.SubsidySlowStartShift()) / consensusParams.nSubsidyHalvingInterval;*/ // Force block reward to zero when right shift is undefined. + int halvings = nHeight / consensusParams.nSubsidyHalvingInterval; if (halvings >= 64) return 0; @@ -3086,7 +3087,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn // Coinbase transaction must include an output sending 20% of // the block reward to `FOUNDERS_REWARD_SCRIPT` until the first // subsidy halving block, with exception to the genesis block. - if ((nHeight > 0) && (nHeight < consensusParams.nSubsidyHalvingInterval)) { + /*if ((nHeight > 0) && (nHeight < consensusParams.nSubsidyHalvingInterval)) { bool found = false; BOOST_FOREACH(const CTxOut& output, block.vtx[0].vout) { @@ -3101,7 +3102,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn if (!found) { return state.DoS(100, error("%s: founders reward missing", __func__), REJECT_INVALID, "cb-no-founders-reward"); } - } + }*/ return true; } diff --git a/src/main.h b/src/main.h index 9c875d8c3..81696009e 100644 --- a/src/main.h +++ b/src/main.h @@ -48,7 +48,7 @@ class CValidationState; struct CNodeStateStats; // This is a 2-of-3 multisig P2SH -static const char *FOUNDERS_REWARD_SCRIPT = "a9146708e6670db0b950dac68031025cc5b63213a49187"; +//static const char *FOUNDERS_REWARD_SCRIPT = "a9146708e6670db0b950dac68031025cc5b63213a49187"; /** Default for -blockmaxsize and -blockminsize, which control the range of sizes the mining code will create **/ static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000; diff --git a/src/miner.cpp b/src/miner.cpp index e1bc60b89..67419da4a 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -335,7 +335,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) txNew.vout[0].scriptPubKey = scriptPubKeyIn; txNew.vout[0].nValue = GetBlockSubsidy(nHeight, chainparams.GetConsensus()); - if ((nHeight > 0) && (nHeight < chainparams.GetConsensus().nSubsidyHalvingInterval)) { + /*if ((nHeight > 0) && (nHeight < chainparams.GetConsensus().nSubsidyHalvingInterval)) { // Founders reward is 20% of the block subsidy auto vFoundersReward = txNew.vout[0].nValue / 5; // Take some reward away from us @@ -346,7 +346,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) // And give it to the founders txNew.vout.push_back(CTxOut(vFoundersReward, CScript(rewardScript.begin(), rewardScript.end()))); - } + }*/ // Add fees txNew.vout[0].nValue += nFees; diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 68a84a6c4..72dc7186d 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -785,13 +785,13 @@ Value getblocksubsidy(const Array& params, bool fHelp) throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); CAmount nReward = GetBlockSubsidy(nHeight, Params().GetConsensus()); - CAmount nFoundersReward = 0; + /*CAmount nFoundersReward = 0; if ((nHeight > 0) && (nHeight < Params().GetConsensus().nSubsidyHalvingInterval)) { nFoundersReward = nReward/5; nReward -= nFoundersReward; - } + }*/ Object result; result.push_back(Pair("miner", ValueFromAmount(nReward))); - result.push_back(Pair("founders", ValueFromAmount(nFoundersReward))); + //result.push_back(Pair("founders", ValueFromAmount(nFoundersReward))); return result; } diff --git a/src/test/compress_tests.cpp b/src/test/compress_tests.cpp index 376ae9368..92fe4728e 100644 --- a/src/test/compress_tests.cpp +++ b/src/test/compress_tests.cpp @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(compress_amounts) BOOST_CHECK(TestPair( CENT, 0x7)); BOOST_CHECK(TestPair( COIN, 0x9)); BOOST_CHECK(TestPair( 50*COIN, 0x32)); - BOOST_CHECK(TestPair(21000000*COIN, 0x1406f40)); + BOOST_CHECK(TestPair(MAX_MONEY, 0x1406f40)); for (uint64_t i = 1; i <= NUM_MULTIPLES_UNIT; i++) BOOST_CHECK(TestEncode(i));