diff --git a/configure.ac b/configure.ac index e671db1e7..e169a0859 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 11) define(_CLIENT_VERSION_REVISION, 1) -define(_CLIENT_VERSION_BUILD, 23) +define(_CLIENT_VERSION_BUILD, 25) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2015) AC_INIT([Darkcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@darkcoin.io],[darkcoin]) diff --git a/src/clientversion.h b/src/clientversion.h index db486da85..f69ba5f19 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -12,7 +12,7 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 11 #define CLIENT_VERSION_REVISION 1 -#define CLIENT_VERSION_BUILD 23 +#define CLIENT_VERSION_BUILD 25 diff --git a/src/core.h b/src/core.h index 504b60e05..f98b4ffd9 100644 --- a/src/core.h +++ b/src/core.h @@ -24,8 +24,8 @@ static const int64_t DARKSEND_POOL_MAX = (999.99*COIN); one party without comprimising the security of InstantX (1000/2150.0)**15 = 1.031e-05 */ -#define INSTANTX_SIGNATURES_REQUIRED 15 -#define INSTANTX_SIGNATURES_TOTAL 20 +#define INSTANTX_SIGNATURES_REQUIRED 20 +#define INSTANTX_SIGNATURES_TOTAL 30 #define MASTERNODE_NOT_PROCESSED 0 // initial state #define MASTERNODE_IS_CAPABLE 1 diff --git a/src/main.cpp b/src/main.cpp index 67183579a..ecfdb937b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2848,26 +2848,22 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo // ----------- instantX transaction scanning ----------- if(IsSporkActive(SPORK_3_INSTANTX_BLOCK_FILTERING)){ - if(!fLargeWorkForkFound && !fLargeWorkInvalidChainFound){ - BOOST_FOREACH(const CTransaction& tx, block.vtx){ - if (!tx.IsCoinBase()){ - //only reject blocks when it's based on complete consensus - BOOST_FOREACH(const CTxIn& in, tx.vin){ - if(mapLockedInputs.count(in.prevout)){ - 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()); - return state.DoS(0, error("CheckBlock() : found conflicting transaction with transaction lock"), - REJECT_INVALID, "conflicting-tx-ix"); - } + BOOST_FOREACH(const CTransaction& tx, block.vtx){ + if (!tx.IsCoinBase()){ + //only reject blocks when it's based on complete consensus + BOOST_FOREACH(const CTxIn& in, tx.vin){ + if(mapLockedInputs.count(in.prevout)){ + 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()); + return state.DoS(0, error("CheckBlock() : found conflicting transaction with transaction lock"), + REJECT_INVALID, "conflicting-tx-ix"); } } } } - } else { - LogPrintf("CheckBlock() : fork detected, skipping transaction locking checks\n"); } } else { - if(fDebug) LogPrintf("CheckBlock() : InstantX block filtering is off\n"); + LogPrintf("CheckBlock() : skipping transaction locking checks\n"); } @@ -2886,65 +2882,61 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo if(fDebug) LogPrintf("CheckBlock() : Masternode payment enforcement is off\n"); } - if(!fLargeWorkForkFound && !fLargeWorkInvalidChainFound){ - if(MasternodePayments) - { - LOCK2(cs_main, mempool.cs); + if(MasternodePayments) + { + LOCK2(cs_main, mempool.cs); - CBlockIndex *pindex = chainActive.Tip(); - if(pindex != NULL){ - if(pindex->GetBlockHash() == block.hashPrevBlock){ - int64_t masternodePaymentAmount = GetMasternodePayment(pindex->nHeight+1, block.vtx[0].GetValueOut()); - bool fIsInitialDownload = IsInitialBlockDownload(); + CBlockIndex *pindex = chainActive.Tip(); + if(pindex != NULL){ + if(pindex->GetBlockHash() == block.hashPrevBlock){ + int64_t masternodePaymentAmount = GetMasternodePayment(pindex->nHeight+1, block.vtx[0].GetValueOut()); + bool fIsInitialDownload = IsInitialBlockDownload(); - // If we don't already have its previous block, skip masternode payment step - if (!fIsInitialDownload && pindex != NULL) - { - bool foundPaymentAmount = false; - bool foundPayee = false; - bool foundPaymentAndPayee = false; + // If we don't already have its previous block, skip masternode payment step + if (!fIsInitialDownload && pindex != NULL) + { + bool foundPaymentAmount = false; + bool foundPayee = false; + bool foundPaymentAndPayee = false; - CScript payee; - if(!masternodePayments.GetBlockPayee(chainActive.Tip()->nHeight+1, payee) || payee == CScript()){ - foundPayee = true; //doesn't require a specific payee + CScript payee; + if(!masternodePayments.GetBlockPayee(chainActive.Tip()->nHeight+1, payee) || payee == CScript()){ + 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; + 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; - 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; - 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; - } + if(!foundPaymentAndPayee) { + CTxDestination address1; + ExtractDestination(payee, address1); + CBitcoinAddress address2(address1); - if(!foundPaymentAndPayee) { - CTxDestination address1; - 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); - } + 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() : 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 { - 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 { - 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 { - LogPrintf("CheckBlock() : skipping masternode payment checks\n"); + LogPrintf("CheckBlock() : pindex is null, skipping masternode payment check\n"); } - } else { - LogPrintf("CheckBlock() : fork detected, skipping masternode payment checks\n"); + } else { + LogPrintf("CheckBlock() : skipping masternode payment checks\n"); } diff --git a/src/masternode.cpp b/src/masternode.cpp index 511dfa14e..a86a658e6 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -513,6 +513,11 @@ int GetMasternodeRank(CTxIn& vin, int64_t nBlockHeight, int minProtocol) //Get the last hash that matches the modulus given. Processed in reverse order bool GetBlockHash(uint256& hash, int nBlockHeight) { + if (chainActive.Tip() == NULL) return false; + + if(nBlockHeight == 0) + nBlockHeight = chainActive.Tip()->nHeight; + if(mapCacheBlockHashes.count(nBlockHeight)){ hash = mapCacheBlockHashes[nBlockHeight]; return true; @@ -521,7 +526,6 @@ bool GetBlockHash(uint256& hash, int nBlockHeight) const CBlockIndex *BlockLastSolved = chainActive.Tip(); const CBlockIndex *BlockReading = chainActive.Tip(); - if (chainActive.Tip() == NULL) return false; if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || chainActive.Tip()->nHeight+1 < nBlockHeight) return false; int nBlocksAgo = 0; @@ -796,9 +800,10 @@ void CMasternodePayments::Relay(CMasternodePaymentWinner& winner) void CMasternodePayments::Sync(CNode* node) { + int a = 0; BOOST_FOREACH(CMasternodePaymentWinner& winner, vWinning) if(winner.nBlockHeight >= chainActive.Tip()->nHeight-10 && winner.nBlockHeight <= chainActive.Tip()->nHeight + 20) - node->PushMessage("mnw", winner); + node->PushMessage("mnw", winner, a); }