remove safemode checks for masternode payments & IX block enforce
This commit is contained in:
parent
b7b2549e56
commit
70c4e0bdee
@ -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, 24)
|
||||
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])
|
||||
|
@ -12,7 +12,7 @@
|
||||
#define CLIENT_VERSION_MAJOR 0
|
||||
#define CLIENT_VERSION_MINOR 11
|
||||
#define CLIENT_VERSION_REVISION 1
|
||||
#define CLIENT_VERSION_BUILD 24
|
||||
#define CLIENT_VERSION_BUILD 25
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
108
src/main.cpp
108
src/main.cpp
@ -2842,26 +2842,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() : 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(!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");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user