mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 21:42:47 +01:00
updating enforcement strategy
This commit is contained in:
parent
c50784d0f6
commit
95b3909493
@ -9,7 +9,7 @@
|
|||||||
#define CLIENT_VERSION_MAJOR 0
|
#define CLIENT_VERSION_MAJOR 0
|
||||||
#define CLIENT_VERSION_MINOR 9
|
#define CLIENT_VERSION_MINOR 9
|
||||||
#define CLIENT_VERSION_REVISION 13
|
#define CLIENT_VERSION_REVISION 13
|
||||||
#define CLIENT_VERSION_BUILD 6
|
#define CLIENT_VERSION_BUILD 7
|
||||||
|
|
||||||
// Set to true for release, false for prerelease or test build
|
// Set to true for release, false for prerelease or test build
|
||||||
#define CLIENT_VERSION_IS_RELEASE true
|
#define CLIENT_VERSION_IS_RELEASE true
|
||||||
|
30
src/main.cpp
30
src/main.cpp
@ -2549,25 +2549,17 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
|
|||||||
if (!fIsInitialDownload && pindexBest != NULL)
|
if (!fIsInitialDownload && pindexBest != NULL)
|
||||||
{
|
{
|
||||||
bool foundPaymentAmount = false;
|
bool foundPaymentAmount = false;
|
||||||
bool foundPaymentPayee = false;
|
|
||||||
CScript payee;
|
|
||||||
bool success = darkSendPool.GetCurrentMasterNodeConsessus(pindexBest->nHeight+1, payee);
|
|
||||||
|
|
||||||
if(success) {
|
|
||||||
for (unsigned int i = 0; i < vtx[0].vout.size(); i++) {
|
for (unsigned int i = 0; i < vtx[0].vout.size(); i++) {
|
||||||
if(vtx[0].vout[i].nValue == masternodePaymentAmount )
|
if(vtx[0].vout[i].nValue == masternodePaymentAmount )
|
||||||
foundPaymentAmount = true;
|
foundPaymentAmount = true;
|
||||||
if(payee == vtx[0].vout[i].scriptPubKey)
|
|
||||||
foundPaymentPayee = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!foundPaymentPayee || !foundPaymentAmount ) {
|
if(!foundPaymentAmount ) {
|
||||||
LogPrintf("CheckBlock() : Couldn't find masternode payment. Found Amount %d Found Payee %d \n", (int)foundPaymentAmount, (int)foundPaymentPayee);
|
LogPrintf("CheckBlock() : Couldn't find masternode payment. \n");
|
||||||
if(EnforceMasternodePayments) return state.DoS(0, error("CheckBlock() : Couldn't find masternode payment"));
|
if(EnforceMasternodePayments) return state.DoS(0, error("CheckBlock() : Couldn't find masternode payment"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 1; i < vtx.size(); i++)
|
for (unsigned int i = 1; i < vtx.size(); i++)
|
||||||
@ -5080,26 +5072,30 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
|
|
||||||
//spork
|
//spork
|
||||||
CScript payee;
|
CScript payee;
|
||||||
bool success = darkSendPool.GetCurrentMasterNodeConsessus(pindexPrev->nHeight+1, payee);
|
|
||||||
if(!success) {
|
|
||||||
//no enforcement
|
|
||||||
winningNode = darkSendPool.GetCurrentMasterNode(1);
|
winningNode = darkSendPool.GetCurrentMasterNode(1);
|
||||||
if(winningNode >= 0){
|
if(winningNode >= 0){
|
||||||
payee.SetDestination(darkSendMasterNodes[winningNode].pubkey.GetID());
|
payee.SetDestination(darkSendMasterNodes[winningNode].pubkey.GetID());
|
||||||
success = true;
|
} else {
|
||||||
|
//if enforcing, then return NULL because the block will be rejected
|
||||||
|
if(pblock->MasterNodePaymentsEnforcing()) {
|
||||||
|
LogPrintf("CreateNewBlock: Failed to detect masternode to pay\n");
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(success) {
|
|
||||||
pblock->payee = payee;
|
pblock->payee = payee;
|
||||||
|
|
||||||
payments++;
|
payments++;
|
||||||
txNew.vout.resize(payments);
|
txNew.vout.resize(payments);
|
||||||
|
|
||||||
//txNew.vout[0].scriptPubKey = scriptPubKeyIn;
|
|
||||||
txNew.vout[payments-1].scriptPubKey = payee;
|
txNew.vout[payments-1].scriptPubKey = payee;
|
||||||
txNew.vout[payments-1].nValue = 0;
|
txNew.vout[payments-1].nValue = 0;
|
||||||
}
|
|
||||||
|
CTxDestination address1;
|
||||||
|
ExtractDestination(payee, address1);
|
||||||
|
CBitcoinAddress address2(address1);
|
||||||
|
|
||||||
|
LogPrintf("Masternode payment to %s\n", address2.ToString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add our coinbase tx as first transaction
|
// Add our coinbase tx as first transaction
|
||||||
|
Loading…
Reference in New Issue
Block a user