Skip to content
Permalink
Browse files

Increase protocol version

  • Loading branch information...
pallas1 committed Jun 11, 2019
1 parent 78500e8 commit 518396debf4ce681dd0be290c35d8f2780538a29
Showing with 12 additions and 10 deletions.
  1. +9 −8 src/masternode-payments.cpp
  2. +2 −1 src/validation.cpp
  3. +1 −1 src/version.h
@@ -146,6 +146,7 @@ bool IsBlockPayeeValid(const CTransactionRef txNew, int nBlockHeight, CAmount bl
const Consensus::Params& consensusParams = Params().GetConsensus();

if(nBlockHeight < consensusParams.nSuperblockStartBlock) {
LogPrintf("IsBlockPayeeValid -- Superblock is not started\n");
if(mnpayments.IsTransactionValid(txNew, nBlockHeight)) {
LogPrintf("IsBlockPayeeValid -- Valid masternode payment at height %d: %s\n", nBlockHeight, txNew->ToString());
return true;
@@ -166,8 +167,8 @@ bool IsBlockPayeeValid(const CTransactionRef txNew, int nBlockHeight, CAmount bl
}

if(sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
LogPrintf("IsBlockPayeeValid -- WARNING: Masternode payment enforcement is ignored, accepting any payee\n");
return true;
LogPrintf("IsBlockPayeeValid -- ERROR: Invalid masternode payment detected at height %d: %s\n", nBlockHeight, txNew->ToString());
return false;
}

LogPrintf("IsBlockPayeeValid -- WARNING: Masternode payment enforcement is disabled, accepting any payee\n");
@@ -615,7 +616,7 @@ void CMasternodeBlockPayees::AddPayee(const CMasternodePaymentVote& vote)
LogPrintf("MASTERNODEPAYMENTVOTE -- masternode is unknown %s\n", vote.vinMasternode.prevout.ToStringShort());
return;
}

CMasternodePayee payeeNew(vote.payee, pmn->GetSinTypeInt(), vote.GetHash());
vecPayees.push_back(payeeNew);
}
@@ -848,19 +849,19 @@ bool CMasternodePaymentVote::IsValid(CNode* pnode, int nValidationHeight, std::s

CMasternode::SinType GetSinType(CAmount burnValue)
{

if ((Params().GetConsensus().nMasternodeBurnSINNODE_1 - 1) * COIN < burnValue && burnValue <= Params().GetConsensus().nMasternodeBurnSINNODE_1 * COIN) {
return CMasternode::SinType::SINNODE_1;
}

if ((Params().GetConsensus().nMasternodeBurnSINNODE_5 -1) * COIN < burnValue && burnValue <= Params().GetConsensus().nMasternodeBurnSINNODE_5 * COIN) {
return CMasternode::SinType::SINNODE_5;
}

if ((Params().GetConsensus().nMasternodeBurnSINNODE_10 - 1) * COIN < burnValue && burnValue <= Params().GetConsensus().nMasternodeBurnSINNODE_10 * COIN) {
return CMasternode::SinType::SINNODE_10;
}

return CMasternode::SinType::SINNODE_UNKNOWN;
}

@@ -907,7 +908,7 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight, CConnman& connman)

CScript payee = GetScriptForDestination(mnInfo.pubKeyCollateralAddress.GetID());
CMasternodePaymentVote voteNew(activeMasternode.outpoint, nBlockHeight, payee);

if(!GetUTXOCoin(mnInfo.vinBurnFund.prevout, coin)) {
nBurnFundValue = 0;
} else {
@@ -2228,11 +2228,12 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl

// Basic testing to ensure pays go to correct sinnode tiers
int forkInfinityNode = 170000;
int enforceHeight = 176500; //observation - change it later
int enforceHeight = 178000;
if (pindex->nHeight > forkInfinityNode)
{
if (!IsBlockPayeeValid(block.vtx[0], pindex->nHeight, block.vtx[0]->GetValueOut(), pindex->GetBlockHeader())) {
mapRejectedBlocks.insert(std::make_pair(block.GetHash(), GetTime()));
LogPrintf("IsBlockPayeeValid -- disconnect block!\n");
if (pindex->nHeight >= enforceHeight) {
return state.DoS(0, error("ConnectBlock(DASH): couldn't find masternode or superblock payments"),
REJECT_INVALID, "bad-cb-payee");
@@ -12,7 +12,7 @@
* network protocol versioning
*/

static const int PROTOCOL_VERSION = 250001;
static const int PROTOCOL_VERSION = 250002;

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

0 comments on commit 518396d

Please sign in to comment.
You can’t perform that action at this time.