From e6ec9665d5a6c5de869f04dee42b6a0e213a1ac3 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Mon, 9 Feb 2015 19:43:39 -0700 Subject: [PATCH 1/2] min proto / version --- configure.ac | 2 +- src/clientversion.h | 2 +- src/version.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index a5fe4587ff..8adb10f00d 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, 18) +define(_CLIENT_VERSION_BUILD, 19) 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 dfb3c6b994..6cb78377f7 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 18 +#define CLIENT_VERSION_BUILD 19 diff --git a/src/version.h b/src/version.h index 5fdfaefe86..b663ba19ed 100644 --- a/src/version.h +++ b/src/version.h @@ -33,7 +33,7 @@ static const int PROTOCOL_VERSION = 70066; static const int INIT_PROTO_VERSION = 209; // disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 70051; +static const int MIN_PEER_PROTO_VERSION = 70054; // nTime field added to CAddress, starting with this version; // if possible, avoid requesting addresses nodes older than this From ba12e5905e0112ab8ad566fe2fdeccddb050ae1c Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Tue, 10 Feb 2015 03:45:21 -0700 Subject: [PATCH 2/2] fixed log message and added checkpoint --- src/checkpoints.cpp | 1 + src/main.cpp | 82 ++++++++++++++++++++++++--------------------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index ddb2a69091..6fd3f5bf5e 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -56,6 +56,7 @@ namespace Checkpoints ( 137993, uint256("0x00000000000cf69ce152b1bffdeddc59188d7a80879210d6e5c9503011929c3c")) ( 167996, uint256("0x000000000009486020a80f7f2cc065342b0c2fb59af5e090cd813dba68ab0fed")) ( 207992, uint256("0x00000000000d85c22be098f74576ef00b7aa00c05777e966aff68a270f1e01a5")) + ( 217752, uint256("0x00000000000a7baeb2148272a7e14edf5af99a64af456c0afc23d15a0918b704")) ; static const CCheckpointData data = { &mapCheckpoints, diff --git a/src/main.cpp b/src/main.cpp index 07e184cc7e..a0785c7f02 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2867,60 +2867,64 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo if(fDebug) LogPrintf("CheckBlock() : Masternode payment enforcement is off\n"); } - if(MasternodePayments && !fLargeWorkForkFound && !fLargeWorkInvalidChainFound) - { - LOCK2(cs_main, mempool.cs); + if(!fLargeWorkForkFound && !fLargeWorkInvalidChainFound){ + 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 - 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 ) + CScript payee; + if(!masternodePayments.GetBlockPayee(chainActive.Tip()->nHeight+1, payee) || payee == CScript()){ + foundPayee = true; //doesn't require a specific payee 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); + } - if(!foundPaymentAndPayee) { - CTxDestination address1; - ExtractDestination(payee, address1); - CBitcoinAddress address2(address1); + 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() : 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")); + 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); + } } else { - LogPrintf("CheckBlock() : Found masternode payment %d\n", chainActive.Tip()->nHeight+1); + LogPrintf("CheckBlock() : Is initial download, skipping masternode payment check %d\n", chainActive.Tip()->nHeight+1); } } else { - LogPrintf("CheckBlock() : Is initial download, skipping masternode payment check %d\n", chainActive.Tip()->nHeight+1); + 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 check - nHeight %d Hash %s\n", chainActive.Tip()->nHeight+1, block.GetHash().ToString().c_str()); + LogPrintf("CheckBlock() : pindex is null, skipping masternode payment check\n"); } } else { - LogPrintf("CheckBlock() : pindex is null, skipping masternode payment check\n"); + LogPrintf("CheckBlock() : skipping masternode payment checks\n"); } - } else { + } else { LogPrintf("CheckBlock() : fork detected, skipping masternode payment checks\n"); }