Commit 57ec6528 authored by Ashot's avatar Ashot

Changed block rewards. Adapted compatibility with mainnet.

parent 5cbc1575
Pipeline #949 passed with stage
in 75 minutes and 25 seconds
......@@ -215,6 +215,7 @@ public:
nTargetSpacing = 1 * 60; // Crown: 1 minutes
nMaxTipAge = 6 * 60 * 60;
nBlockPoSStart = 2330000;
nAuxpowChainId = 20;
nPoSChainId = 22;
nStakePointerValidityPeriod = 1440; //Stake pointers are valid to stake with for the next 1 day worth of blocks
......
......@@ -801,6 +801,12 @@ bool AppInit2(boost::thread_group& threadGroup)
if (nFD - MIN_CORE_FILEDESCRIPTORS < nMaxConnections)
nMaxConnections = nFD - MIN_CORE_FILEDESCRIPTORS;
// -masternode or -systemnode imply staking
if (GetBoolArg("-masternode", false) || GetBoolArg("-systemnode", false)) {
if (SoftSetBoolArg("-staking", true))
LogPrintf("AppInit2 : parameter interaction: -masternode or -systemnode -> setting -staking=1\n");
}
// ********************************************************* Step 3: parameter-to-internal-flags
fDebug = !mapMultiArgs["-debug"].empty();
......
......@@ -1646,9 +1646,14 @@ double ConvertBitsToDouble(unsigned int nBits)
return dDiff;
}
int64_t GetBlockValue(int nHeight, const CAmount &nFees)
int64_t GetSubsidy(int nHeight, const CAmount &nFees)
{
int64_t nSubsidy = 12 * COIN;
if (nHeight >= Params().PoSStartHeight())
{
nSubsidy = 10 * COIN;
}
int halvings = nHeight / Params().SubsidyHalvingInterval();
// Force block reward to zero when right shift is undefined.
......@@ -1657,22 +1662,28 @@ int64_t GetBlockValue(int nHeight, const CAmount &nFees)
// Subsidy is cut in half every 2,100,000 blocks which will occur approximately every 4 years.
nSubsidy >>= halvings;
return nSubsidy;
}
int64_t GetBlockValue(int nHeight, const CAmount &nFees)
{
int64_t nSubsidy = GetSubsidy(nHeight, nFees);
if (Params().NetworkID() == CBaseChainParams::DEVNET)
{
if (nHeight == 2)
return 1000000 * COIN;
}
int64_t budgetValue = nSubsidy * 0.25; // budget payment is 25%
if (Params().NetworkID() == CBaseChainParams::TESTNET)
{
if (nHeight > 20000)
nSubsidy -= nSubsidy * 0.25; // budget payment is 25%
nSubsidy -= budgetValue;
}
else
{
if (nHeight > 1265000)
nSubsidy -= nSubsidy * 0.25; // budget payment is 25%
nSubsidy -= budgetValue;
}
return nSubsidy + nFees;
......@@ -1680,14 +1691,23 @@ int64_t GetBlockValue(int nHeight, const CAmount &nFees)
int64_t GetMasternodePayment(int nHeight, int64_t blockValue)
{
int64_t ret = blockValue*0.5; // start at 50%
// 25% percent is already taken for budget
int64_t ret = (blockValue * 37.5) / 75; // 37.5%
if (nHeight >= Params().PoSStartHeight())
{
ret = (blockValue * 37) / 75; // 37%
}
return ret;
}
int64_t GetSystemnodePayment(int nHeight, int64_t blockValue)
{
int64_t ret = blockValue * 0.1; // start at 10%
// 25% percent is already taken for budget
int64_t ret = (blockValue * 7.5) / 75; // 7.5%
if (nHeight >= Params().PoSStartHeight())
{
ret = (blockValue * 8) / 75; // 8%
}
return ret;
}
......
......@@ -705,11 +705,15 @@ std::string CBudgetManager::GetRequiredPaymentsString(int nBlockHeight) const
CAmount CBudgetManager::GetTotalBudget(int nHeight)
{
if(chainActive.Tip() == NULL) return 0;
//get min block value and calculate from that
CAmount nSubsidy = 12 * COIN;
if (nHeight >= Params().PoSStartHeight())
{
nSubsidy = 10 * COIN;
}
int halvings = nHeight / Params().SubsidyHalvingInterval();
// Subsidy is cut in half every 2,100,000 blocks which will occur approximately every 4 years.
......
......@@ -321,7 +321,10 @@ public:
READWRITE(protocolVersion);
READWRITE(lastPing);
READWRITE(nLastDsq);
READWRITE(vchSignover);
if (protocolVersion >= PROTOCOL_POS_START)
{
READWRITE(vchSignover);
}
}
uint256 GetHash() const
......
......@@ -275,7 +275,10 @@ public:
READWRITE(sigTime);
READWRITE(protocolVersion);
READWRITE(lastPing);
READWRITE(vchSignover);
if (protocolVersion >= PROTOCOL_POS_START)
{
READWRITE(vchSignover);
}
}
uint256 GetHash() const
......
......@@ -9,8 +9,8 @@
/**
* network protocol versioning
*/
static const int PROTOCOL_VERSION = 71060;
static const int PROTOCOL_POS_START = 71060;
static const int PROTOCOL_VERSION = 71061;
static const int PROTOCOL_POS_START = 71061;
//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
......@@ -29,7 +29,7 @@ static const int MIN_BUDGET_PEER_PROTO_VERSION = PROTOCOL_POS_START;
static const int MIN_MNW_PEER_PROTO_VERSION = PROTOCOL_POS_START;
//! minimum version to get version 2 masternode ping messages
static const int MIN_MNW_PING_VERSION = 71060;
static const int MIN_MNW_PING_VERSION = 71061;
//! minimum peer version that can receive masternode payments
// V1 - Last protocol version before update
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment