coin supply, rewards
This commit is contained in:
@@ -17,7 +17,7 @@ static const CAmount COIN = 100000000;
|
|||||||
static const CAmount CENT = 1000000;
|
static const CAmount CENT = 1000000;
|
||||||
|
|
||||||
/** No amount larger than this (in satoshi) is valid */
|
/** 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); }
|
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
|
||||||
|
|
||||||
/** Type-safe wrapper class to for fee rates
|
/** Type-safe wrapper class to for fee rates
|
||||||
|
|||||||
11
src/main.cpp
11
src/main.cpp
@@ -1367,8 +1367,8 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex)
|
|||||||
|
|
||||||
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
|
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
|
||||||
{
|
{
|
||||||
CAmount nSubsidy = 12.5 * COIN;
|
CAmount nSubsidy = 3 * COIN;
|
||||||
|
/*
|
||||||
// Mining slow start
|
// Mining slow start
|
||||||
// The subsidy is ramped up linearly, skipping the middle payout of
|
// The subsidy is ramped up linearly, skipping the middle payout of
|
||||||
// MAX_SUBSIDY/2 to keep the monetary curve consistent with no slow start.
|
// 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());
|
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.
|
// Force block reward to zero when right shift is undefined.
|
||||||
|
int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
|
||||||
if (halvings >= 64)
|
if (halvings >= 64)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -3086,7 +3087,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
|
|||||||
// Coinbase transaction must include an output sending 20% of
|
// Coinbase transaction must include an output sending 20% of
|
||||||
// the block reward to `FOUNDERS_REWARD_SCRIPT` until the first
|
// the block reward to `FOUNDERS_REWARD_SCRIPT` until the first
|
||||||
// subsidy halving block, with exception to the genesis block.
|
// subsidy halving block, with exception to the genesis block.
|
||||||
if ((nHeight > 0) && (nHeight < consensusParams.nSubsidyHalvingInterval)) {
|
/*if ((nHeight > 0) && (nHeight < consensusParams.nSubsidyHalvingInterval)) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
BOOST_FOREACH(const CTxOut& output, block.vtx[0].vout) {
|
BOOST_FOREACH(const CTxOut& output, block.vtx[0].vout) {
|
||||||
@@ -3101,7 +3102,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
return state.DoS(100, error("%s: founders reward missing", __func__), REJECT_INVALID, "cb-no-founders-reward");
|
return state.DoS(100, error("%s: founders reward missing", __func__), REJECT_INVALID, "cb-no-founders-reward");
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class CValidationState;
|
|||||||
struct CNodeStateStats;
|
struct CNodeStateStats;
|
||||||
|
|
||||||
// This is a 2-of-3 multisig P2SH
|
// 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 **/
|
/** 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;
|
static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000;
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
|
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
|
||||||
txNew.vout[0].nValue = GetBlockSubsidy(nHeight, chainparams.GetConsensus());
|
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
|
// Founders reward is 20% of the block subsidy
|
||||||
auto vFoundersReward = txNew.vout[0].nValue / 5;
|
auto vFoundersReward = txNew.vout[0].nValue / 5;
|
||||||
// Take some reward away from us
|
// Take some reward away from us
|
||||||
@@ -346,7 +346,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
// And give it to the founders
|
// And give it to the founders
|
||||||
txNew.vout.push_back(CTxOut(vFoundersReward, CScript(rewardScript.begin(),
|
txNew.vout.push_back(CTxOut(vFoundersReward, CScript(rewardScript.begin(),
|
||||||
rewardScript.end())));
|
rewardScript.end())));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Add fees
|
// Add fees
|
||||||
txNew.vout[0].nValue += nFees;
|
txNew.vout[0].nValue += nFees;
|
||||||
|
|||||||
@@ -785,13 +785,13 @@ Value getblocksubsidy(const Array& params, bool fHelp)
|
|||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");
|
||||||
|
|
||||||
CAmount nReward = GetBlockSubsidy(nHeight, Params().GetConsensus());
|
CAmount nReward = GetBlockSubsidy(nHeight, Params().GetConsensus());
|
||||||
CAmount nFoundersReward = 0;
|
/*CAmount nFoundersReward = 0;
|
||||||
if ((nHeight > 0) && (nHeight < Params().GetConsensus().nSubsidyHalvingInterval)) {
|
if ((nHeight > 0) && (nHeight < Params().GetConsensus().nSubsidyHalvingInterval)) {
|
||||||
nFoundersReward = nReward/5;
|
nFoundersReward = nReward/5;
|
||||||
nReward -= nFoundersReward;
|
nReward -= nFoundersReward;
|
||||||
}
|
}*/
|
||||||
Object result;
|
Object result;
|
||||||
result.push_back(Pair("miner", ValueFromAmount(nReward)));
|
result.push_back(Pair("miner", ValueFromAmount(nReward)));
|
||||||
result.push_back(Pair("founders", ValueFromAmount(nFoundersReward)));
|
//result.push_back(Pair("founders", ValueFromAmount(nFoundersReward)));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(compress_amounts)
|
|||||||
BOOST_CHECK(TestPair( CENT, 0x7));
|
BOOST_CHECK(TestPair( CENT, 0x7));
|
||||||
BOOST_CHECK(TestPair( COIN, 0x9));
|
BOOST_CHECK(TestPair( COIN, 0x9));
|
||||||
BOOST_CHECK(TestPair( 50*COIN, 0x32));
|
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++)
|
for (uint64_t i = 1; i <= NUM_MULTIPLES_UNIT; i++)
|
||||||
BOOST_CHECK(TestEncode(i));
|
BOOST_CHECK(TestEncode(i));
|
||||||
|
|||||||
Reference in New Issue
Block a user