Skip to content

Commit 6faee5e

Browse files
semiformalalejandromgk
authored andcommitted
Rewards: Adjust Miner/Masternode reward ratio - Add sentinel version check - Bump version to v0.12.3.0 (#27)
* Update the version number * Bump to 70213 * Adjust Rewards * Update sentinel ping code to require min version * Update blockHeight for reward change, update client version and copyright
1 parent 3f06348 commit 6faee5e

13 files changed

+55
-30
lines changed

configure.ac

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
22
AC_PREREQ([2.60])
33
define(_CLIENT_VERSION_MAJOR, 0)
44
define(_CLIENT_VERSION_MINOR, 12)
5-
define(_CLIENT_VERSION_REVISION, 2)
6-
define(_CLIENT_VERSION_BUILD, 3)
5+
define(_CLIENT_VERSION_REVISION, 3)
6+
define(_CLIENT_VERSION_BUILD, 0)
77
define(_CLIENT_VERSION_IS_RELEASE, true)
8-
define(_COPYRIGHT_YEAR, 2017)
8+
define(_COPYRIGHT_YEAR, 2018)
99
AC_INIT([Paccoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/paccoinpay/paccoin/issues],[paccoincore])
1010
AC_CONFIG_SRCDIR([src/validation.cpp])
1111
AC_CONFIG_HEADERS([src/config/paccoin-config.h])

src/activemasternode.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,13 @@ bool CActiveMasternode::SendMasternodePing(CConnman& connman)
120120
bool CActiveMasternode::UpdateSentinelPing(int version)
121121
{
122122
nSentinelVersion = version;
123+
if(version < MIN_SENTINEL_VERSION ){
124+
LogPrintf("CActiveMasternode::UpdateSentinelPing -- Sentinel is out of date please update. Version = %s\n", SafeIntVersionToString(version));
125+
return false;
126+
}
127+
123128
nSentinelPingTime = GetAdjustedTime();
129+
LogPrint("masternode", "CActiveMasternode::UpdateSentinelPing -- Updated Sentinel Version = %s PingTime = %d\n", SafeIntVersionToString(nSentinelVersion), nSentinelPingTime);
124130

125131
return true;
126132
}
@@ -197,7 +203,7 @@ void CActiveMasternode::ManageStateInitial(CConnman& connman)
197203

198204
void CActiveMasternode::ManageStateRemote()
199205
{
200-
LogPrint("masternode", "CActiveMasternode::ManageStateRemote -- Start status = %s, type = %s, pinger enabled = %d, pubKeyMasternode.GetID() = %s\n",
206+
LogPrint("masternode", "CActiveMasternode::ManageStateRemote -- Start status = %s, type = %s, pinger enabled = %d, pubKeyMasternode.GetID() = %s\n",
201207
GetStatus(), GetTypeString(), fPingerEnabled, pubKeyMasternode.GetID().ToString());
202208

203209
mnodeman.CheckMasternode(pubKeyMasternode, true);

src/chainparams.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ class CMainParams : public CChainParams {
120120
strNetworkID = "main";
121121
consensus.nSubsidyHalvingInterval = 210240; // Note: actual number of blocks per calendar year with DGW v3 is ~200700 (for example 449750 - 249050)
122122
consensus.nMasternodePaymentsStartBlock = 200; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
123-
consensus.nMasternodePaymentsIncreaseBlock = 158000; // actual historical value
124-
consensus.nMasternodePaymentsIncreasePeriod = 576*30; // 17280 - actual historical value
123+
consensus.nMasternodePaymentsIncreaseBlock = 50000; // 50000 height aproximately April 20th
124+
consensus.nMasternodePaymentsIncreasePeriod = 576*30; // Not used
125125
consensus.nInstantSendKeepLock = 24;
126126
consensus.nBudgetPaymentsStartBlock = 200; // actual historical value
127127
consensus.nBudgetPaymentsCycleBlocks = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725
@@ -241,7 +241,7 @@ class CTestNetParams : public CChainParams {
241241
strNetworkID = "test";
242242
consensus.nSubsidyHalvingInterval = 210240;
243243
consensus.nMasternodePaymentsStartBlock = 2; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
244-
consensus.nMasternodePaymentsIncreaseBlock = 4030;
244+
consensus.nMasternodePaymentsIncreaseBlock = 6200;
245245
consensus.nMasternodePaymentsIncreasePeriod = 10;
246246
consensus.nInstantSendKeepLock = 6;
247247
consensus.nBudgetPaymentsStartBlock = 2;

src/clientversion.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
//! These need to be macros, as clientversion.cpp's and paccoin*-res.rc's voodoo requires it
1717
#define CLIENT_VERSION_MAJOR 0
1818
#define CLIENT_VERSION_MINOR 12
19-
#define CLIENT_VERSION_REVISION 2
20-
#define CLIENT_VERSION_BUILD 3
19+
#define CLIENT_VERSION_REVISION 3
20+
#define CLIENT_VERSION_BUILD 0
2121

2222
//! Set to true for release, false for prerelease or test build
2323
#define CLIENT_VERSION_IS_RELEASE true
@@ -26,7 +26,7 @@
2626
* Copyright year (2009-this)
2727
* Todo: update this when changing our copyright comments in the source
2828
*/
29-
#define COPYRIGHT_YEAR 2017
29+
#define COPYRIGHT_YEAR 2018
3030

3131
#endif //HAVE_CONFIG_H
3232

src/masternode-payments.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int nBlockH
282282
}
283283

284284
// GET MASTERNODE PAYMENT VARIABLES SETUP
285-
CAmount masternodePayment = GetMasternodePayment(nBlockHeight, blockReward);
285+
CAmount masternodePayment = GetMasternodePayment(nBlockHeight, blockReward, Params().GetConsensus());
286286

287287
// split reward between miner ...
288288
txNew.vout[0].nValue -= masternodePayment;
@@ -549,7 +549,7 @@ bool CMasternodeBlockPayees::IsTransactionValid(const CTransaction& txNew)
549549
int nMaxSignatures = 0;
550550
std::string strPayeesPossible = "";
551551

552-
CAmount nMasternodePayment = GetMasternodePayment(nBlockHeight, txNew.GetValueOut());
552+
CAmount nMasternodePayment = GetMasternodePayment(nBlockHeight, txNew.GetValueOut(), Params().GetConsensus());
553553

554554
//require at least MNPAYMENTS_SIGNATURES_REQUIRED signatures
555555

src/masternode-payments.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static const int MNPAYMENTS_SIGNATURES_TOTAL = 10;
2424
// V1 - Last protocol version before update
2525
// V2 - Newest protocol version
2626
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 70206;
27-
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70208;
27+
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70213;
2828

2929
extern CCriticalSection cs_vecPayees;
3030
extern CCriticalSection cs_mapMasternodeBlocks;

src/masternode.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ void CMasternode::UpdateLastPaid(const CBlockIndex *pindex, int nMaxBlocksToScan
324324
if(!ReadBlockFromDisk(block, BlockReading, Params().GetConsensus())) // shouldn't really happen
325325
continue;
326326

327-
CAmount nMasternodePayment = GetMasternodePayment(BlockReading->nHeight, block.vtx[0].GetValueOut());
327+
CAmount nMasternodePayment = GetMasternodePayment(BlockReading->nHeight, block.vtx[0].GetValueOut(), Params().GetConsensus());
328328

329329
BOOST_FOREACH(CTxOut txout, block.vtx[0].vout)
330330
if(mnpayee == txout.scriptPubKey && nMasternodePayment == txout.nValue) {

src/masternode.h

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ static const int MASTERNODE_POSE_BAN_MAX_SCORE = 5;
2929
// sentinel version before sentinel ping implementation
3030
#define DEFAULT_SENTINEL_VERSION 0x010001
3131

32+
// sentinel with voting fix to enable proposals
33+
#define MIN_SENTINEL_VERSION 0x010200
34+
35+
3236
class CMasternodePing
3337
{
3438
public:

src/rpc/governance.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,16 @@ UniValue gobject(const UniValue& params, bool fHelp)
344344
return returnObj;
345345
}
346346

347+
if(mn.IsWatchdogExpired()) {
348+
nFailed++;
349+
statusObj.push_back(Pair("result", "failed"));
350+
statusObj.push_back(Pair("errorMessage", "WATCHDOG_EXPIRED nodes aren't allowed to vote."));
351+
resultsObj.push_back(Pair("paccoin.conf", statusObj));
352+
returnObj.push_back(Pair("overall", strprintf("Voted successfully %d time(s) and failed %d time(s).", nSuccessful, nFailed)));
353+
returnObj.push_back(Pair("detail", resultsObj));
354+
return returnObj;
355+
}
356+
347357
CGovernanceVote vote(mn.vin.prevout, hash, eVoteSignal, eVoteOutcome);
348358
if(!vote.Sign(activeMasternode.keyMasternode, activeMasternode.pubKeyMasternode)) {
349359
nFailed++;

src/rpc/masternode.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,5 @@ UniValue sentinelping(const UniValue& params, bool fHelp)
846846
);
847847
}
848848

849-
activeMasternode.UpdateSentinelPing(StringVersionToInt(params[0].get_str()));
850-
return true;
849+
return activeMasternode.UpdateSentinelPing(StringVersionToInt(params[0].get_str()));
851850
}

src/validation.cpp

+14-8
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params&
12391239
} else {
12401240
dDiff = ConvertBitsToDouble(nPrevBits);
12411241
}
1242-
1242+
12431243
if (nPrevHeight < 100)
12441244
{
12451245
nSubsidyBase = 35500000;
@@ -1260,17 +1260,23 @@ CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params&
12601260
return fSuperblockPartOnly ? nSuperblockPart : nSubsidy - nSuperblockPart;
12611261
}
12621262

1263-
CAmount GetMasternodePayment(int nHeight, CAmount blockValue)
1263+
CAmount GetMasternodePayment(int nHeight, CAmount blockValue, const Consensus::Params& consensusParams)
12641264
{
1265-
double dMasternodePart = 9.0/16.0;
1266-
CAmount ret = blockValue * dMasternodePart; // 45% of the total block reward.
1267-
return ret;
1265+
double dMasternodePart;
1266+
1267+
if(nHeight < consensusParams.nMasternodePaymentsIncreaseBlock){
1268+
dMasternodePart = 9.0/16.0; // 56.25% of the block reward.
1269+
} else {
1270+
dMasternodePart = 15.0/16.0; // 93.75% of the block reward.
1271+
}
1272+
1273+
return (blockValue * dMasternodePart);
12681274
}
12691275

12701276
double GetSubsidyMultiplier(int nPrevHeight, int nSubsidyAdjustmentInterval)
12711277
{
12721278
double dMultiplier = 0.0;
1273-
1279+
12741280
if (nPrevHeight < 100) {
12751281
dMultiplier = 1.0;
12761282
} else if (nPrevHeight <= nSubsidyAdjustmentInterval * 1) {
@@ -1292,7 +1298,7 @@ double GetSubsidyMultiplier(int nPrevHeight, int nSubsidyAdjustmentInterval)
12921298
} else {
12931299
dMultiplier = 0.0;
12941300
}
1295-
1301+
12961302
return dMultiplier;
12971303
}
12981304

@@ -3959,7 +3965,7 @@ bool LoadBlockIndex()
39593965
return true;
39603966
}
39613967

3962-
bool InitBlockIndex(const CChainParams& chainparams)
3968+
bool InitBlockIndex(const CChainParams& chainparams)
39633969
{
39643970
LOCK(cs_main);
39653971

src/validation.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static const unsigned int DEFAULT_CHECKLEVEL = 3;
198198
// Setting the target to > than 945MB will make it likely we can respect the target.
199199
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 945 * 1024 * 1024;
200200

201-
/**
201+
/**
202202
* Process an incoming block. This only returns after the best known valid
203203
* block is made active. Note that it does not, however, guarantee that the
204204
* specific block passed to it has been checked for validity!
@@ -209,7 +209,7 @@ static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 945 * 1024 * 1024;
209209
*
210210
* Note that we guarantee that either the proof-of-work is valid on pblock, or
211211
* (and possibly also) BlockChecked will have been called.
212-
*
212+
*
213213
* @param[in] pblock The block we want to process.
214214
* @param[in] fForceProcessing Process this block even if unrequested; used for non-network block sources and whitelisted peers.
215215
* @param[out] dbp The already known disk position of pblock, or NULL if not yet stored.
@@ -263,7 +263,7 @@ bool ActivateBestChain(CValidationState& state, const CChainParams& chainparams,
263263

264264
double ConvertBitsToDouble(unsigned int nBits);
265265
CAmount GetBlockSubsidy(int nBits, int nHeight, const Consensus::Params& consensusParams, bool fSuperblockPartOnly = false);
266-
CAmount GetMasternodePayment(int nHeight, CAmount blockValue);
266+
CAmount GetMasternodePayment(int nHeight, CAmount blockValue, const Consensus::Params& consensusParams);
267267
double GetSubsidyMultiplier(int nPrevHeight, int nSubsidyAdjustmentInterval);
268268

269269
/**
@@ -318,7 +318,7 @@ unsigned int GetLegacySigOpCount(const CTransaction& tx);
318318

319319
/**
320320
* Count ECDSA signature operations in pay-to-script-hash inputs.
321-
*
321+
*
322322
* @param[in] mapInputs Map of previous transactions that have outputs we're spending
323323
* @return maximum number of sigops required to validate this transaction's inputs
324324
* @see CTransaction::FetchInputs
@@ -381,7 +381,7 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp = NULL
381381

382382
/**
383383
* Closure representing one script verification
384-
* Note that this stores references to the spending transaction
384+
* Note that this stores references to the spending transaction
385385
*/
386386
class CScriptCheck
387387
{

src/version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* network protocol versioning
1111
*/
1212

13-
static const int PROTOCOL_VERSION = 70212;
13+
static const int PROTOCOL_VERSION = 70213;
1414

1515
//! initial proto version, to be increased after version/verack negotiation
1616
static const int INIT_PROTO_VERSION = 209;

0 commit comments

Comments
 (0)