remove safemode checks for masternode payments & IX block enforce

This commit is contained in:
Evan Duffield 2015-02-13 12:22:58 -07:00
parent b7b2549e56
commit 70c4e0bdee
4 changed files with 54 additions and 62 deletions

View File

@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 11) define(_CLIENT_VERSION_MINOR, 11)
define(_CLIENT_VERSION_REVISION, 1) define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_BUILD, 24) define(_CLIENT_VERSION_BUILD, 25)
define(_CLIENT_VERSION_IS_RELEASE, true) define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2015) define(_COPYRIGHT_YEAR, 2015)
AC_INIT([Darkcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@darkcoin.io],[darkcoin]) AC_INIT([Darkcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@darkcoin.io],[darkcoin])

View File

@ -12,7 +12,7 @@
#define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 11 #define CLIENT_VERSION_MINOR 11
#define CLIENT_VERSION_REVISION 1 #define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_BUILD 24 #define CLIENT_VERSION_BUILD 25

View File

@ -24,8 +24,8 @@ static const int64_t DARKSEND_POOL_MAX = (999.99*COIN);
one party without comprimising the security of InstantX one party without comprimising the security of InstantX
(1000/2150.0)**15 = 1.031e-05 (1000/2150.0)**15 = 1.031e-05
*/ */
#define INSTANTX_SIGNATURES_REQUIRED 15 #define INSTANTX_SIGNATURES_REQUIRED 20
#define INSTANTX_SIGNATURES_TOTAL 20 #define INSTANTX_SIGNATURES_TOTAL 30
#define MASTERNODE_NOT_PROCESSED 0 // initial state #define MASTERNODE_NOT_PROCESSED 0 // initial state
#define MASTERNODE_IS_CAPABLE 1 #define MASTERNODE_IS_CAPABLE 1

View File

@ -2842,26 +2842,22 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
// ----------- instantX transaction scanning ----------- // ----------- instantX transaction scanning -----------
if(IsSporkActive(SPORK_3_INSTANTX_BLOCK_FILTERING)){ if(IsSporkActive(SPORK_3_INSTANTX_BLOCK_FILTERING)){
if(!fLargeWorkForkFound && !fLargeWorkInvalidChainFound){ BOOST_FOREACH(const CTransaction& tx, block.vtx){
BOOST_FOREACH(const CTransaction& tx, block.vtx){ if (!tx.IsCoinBase()){
if (!tx.IsCoinBase()){ //only reject blocks when it's based on complete consensus
//only reject blocks when it's based on complete consensus BOOST_FOREACH(const CTxIn& in, tx.vin){
BOOST_FOREACH(const CTxIn& in, tx.vin){ if(mapLockedInputs.count(in.prevout)){
if(mapLockedInputs.count(in.prevout)){ if(mapLockedInputs[in.prevout] != tx.GetHash()){
if(mapLockedInputs[in.prevout] != tx.GetHash()){ LogPrintf("CheckBlock() : found conflicting transaction with transaction lock %s %s\n", mapLockedInputs[in.prevout].ToString().c_str(), tx.GetHash().ToString().c_str());
LogPrintf("CheckBlock() : found conflicting transaction with transaction lock %s %s\n", mapLockedInputs[in.prevout].ToString().c_str(), tx.GetHash().ToString().c_str()); return state.DoS(0, error("CheckBlock() : found conflicting transaction with transaction lock"),
return state.DoS(0, error("CheckBlock() : found conflicting transaction with transaction lock"), REJECT_INVALID, "conflicting-tx-ix");
REJECT_INVALID, "conflicting-tx-ix");
}
} }
} }
} }
} }
} else {
LogPrintf("CheckBlock() : fork detected, skipping transaction locking checks\n");
} }
} else { } else {
if(fDebug) LogPrintf("CheckBlock() : InstantX block filtering is off\n"); LogPrintf("CheckBlock() : fork detected, skipping transaction locking checks\n");
} }
@ -2880,65 +2876,61 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
if(fDebug) LogPrintf("CheckBlock() : Masternode payment enforcement is off\n"); if(fDebug) LogPrintf("CheckBlock() : Masternode payment enforcement is off\n");
} }
if(!fLargeWorkForkFound && !fLargeWorkInvalidChainFound){ if(MasternodePayments)
if(MasternodePayments) {
{ LOCK2(cs_main, mempool.cs);
LOCK2(cs_main, mempool.cs);
CBlockIndex *pindex = chainActive.Tip(); CBlockIndex *pindex = chainActive.Tip();
if(pindex != NULL){ if(pindex != NULL){
if(pindex->GetBlockHash() == block.hashPrevBlock){ if(pindex->GetBlockHash() == block.hashPrevBlock){
int64_t masternodePaymentAmount = GetMasternodePayment(pindex->nHeight+1, block.vtx[0].GetValueOut()); int64_t masternodePaymentAmount = GetMasternodePayment(pindex->nHeight+1, block.vtx[0].GetValueOut());
bool fIsInitialDownload = IsInitialBlockDownload(); bool fIsInitialDownload = IsInitialBlockDownload();
// If we don't already have its previous block, skip masternode payment step // If we don't already have its previous block, skip masternode payment step
if (!fIsInitialDownload && pindex != NULL) if (!fIsInitialDownload && pindex != NULL)
{ {
bool foundPaymentAmount = false; bool foundPaymentAmount = false;
bool foundPayee = false; bool foundPayee = false;
bool foundPaymentAndPayee = false; bool foundPaymentAndPayee = false;
CScript payee; CScript payee;
if(!masternodePayments.GetBlockPayee(chainActive.Tip()->nHeight+1, payee) || payee == CScript()){ if(!masternodePayments.GetBlockPayee(chainActive.Tip()->nHeight+1, payee) || payee == CScript()){
foundPayee = true; //doesn't require a specific payee foundPayee = true; //doesn't require a specific payee
foundPaymentAmount = true;
foundPaymentAndPayee = true;
LogPrintf("CheckBlock() : Using non-specific masternode payments %d\n", chainActive.Tip()->nHeight+1);
}
for (unsigned int i = 0; i < block.vtx[0].vout.size(); i++) {
if(block.vtx[0].vout[i].nValue == masternodePaymentAmount )
foundPaymentAmount = true; foundPaymentAmount = true;
if(block.vtx[0].vout[i].scriptPubKey == payee )
foundPayee = true;
if(block.vtx[0].vout[i].nValue == masternodePaymentAmount && block.vtx[0].vout[i].scriptPubKey == payee)
foundPaymentAndPayee = true; foundPaymentAndPayee = true;
LogPrintf("CheckBlock() : Using non-specific masternode payments %d\n", chainActive.Tip()->nHeight+1); }
}
for (unsigned int i = 0; i < block.vtx[0].vout.size(); i++) { if(!foundPaymentAndPayee) {
if(block.vtx[0].vout[i].nValue == masternodePaymentAmount ) CTxDestination address1;
foundPaymentAmount = true; ExtractDestination(payee, address1);
if(block.vtx[0].vout[i].scriptPubKey == payee ) CBitcoinAddress address2(address1);
foundPayee = true;
if(block.vtx[0].vout[i].nValue == masternodePaymentAmount && block.vtx[0].vout[i].scriptPubKey == payee)
foundPaymentAndPayee = true;
}
if(!foundPaymentAndPayee) { LogPrintf("CheckBlock() : Couldn't find masternode payment(%d|%d) or payee(%d|%s) nHeight %d. \n", foundPaymentAmount, masternodePaymentAmount, foundPayee, address2.ToString().c_str(), chainActive.Tip()->nHeight+1);
CTxDestination address1; if(!RegTest()) return state.DoS(100, error("CheckBlock() : Couldn't find masternode payment or payee"));
ExtractDestination(payee, address1);
CBitcoinAddress address2(address1);
LogPrintf("CheckBlock() : Couldn't find masternode payment(%d|%d) or payee(%d|%s) nHeight %d. \n", foundPaymentAmount, masternodePaymentAmount, foundPayee, address2.ToString().c_str(), chainActive.Tip()->nHeight+1);
if(!RegTest()) return state.DoS(100, error("CheckBlock() : Couldn't find masternode payment or payee"));
} else {
LogPrintf("CheckBlock() : Found masternode payment %d\n", chainActive.Tip()->nHeight+1);
}
} else { } else {
LogPrintf("CheckBlock() : Is initial download, skipping masternode payment check %d\n", chainActive.Tip()->nHeight+1); LogPrintf("CheckBlock() : Found masternode payment %d\n", chainActive.Tip()->nHeight+1);
} }
} else { } else {
LogPrintf("CheckBlock() : Skipping masternode payment check - nHeight %d Hash %s\n", chainActive.Tip()->nHeight+1, block.GetHash().ToString().c_str()); LogPrintf("CheckBlock() : Is initial download, skipping masternode payment check %d\n", chainActive.Tip()->nHeight+1);
} }
} else { } else {
LogPrintf("CheckBlock() : pindex is null, skipping masternode payment check\n"); LogPrintf("CheckBlock() : Skipping masternode payment check - nHeight %d Hash %s\n", chainActive.Tip()->nHeight+1, block.GetHash().ToString().c_str());
} }
} else { } else {
LogPrintf("CheckBlock() : skipping masternode payment checks\n"); LogPrintf("CheckBlock() : pindex is null, skipping masternode payment check\n");
} }
} else { } else {
LogPrintf("CheckBlock() : fork detected, skipping masternode payment checks\n"); LogPrintf("CheckBlock() : skipping masternode payment checks\n");
} }