Add superblock checks in various places

This commit is contained in:
Evan Duffield 2015-08-03 11:37:58 -07:00
parent 18635f0979
commit e0031a807e
2 changed files with 15 additions and 13 deletions

View File

@ -232,16 +232,18 @@ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight)
}
//check if it's a budget block
if(budget.IsBudgetPaymentBlock(nBlockHeight)){
if(budget.IsTransactionValid(txNew, nBlockHeight)){
return true;
} else {
LogPrintf("Invalid budget payment detected %s\n", txNew.ToString().c_str());
if(IsSporkActive(SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT)){
return false;
} else {
LogPrintf("Budget enforcement is disabled, accepting block\n");
if(IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS)){
if(budget.IsBudgetPaymentBlock(nBlockHeight)){
if(budget.IsTransactionValid(txNew, nBlockHeight)){
return true;
} else {
LogPrintf("Invalid budget payment detected %s\n", txNew.ToString().c_str());
if(IsSporkActive(SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT)){
return false;
} else {
LogPrintf("Budget enforcement is disabled, accepting block\n");
return true;
}
}
}
}
@ -269,7 +271,7 @@ void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees)
CBlockIndex* pindexPrev = chainActive.Tip();
if(!pindexPrev) return;
if(budget.IsBudgetPaymentBlock(pindexPrev->nHeight+1)){
if(IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(pindexPrev->nHeight+1)){
budget.FillBlockPayee(txNew, nFees);
} else {
masternodePayments.FillBlockPayee(txNew, nFees);
@ -278,7 +280,7 @@ void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees)
std::string GetRequiredPaymentsString(int nBlockHeight)
{
if(budget.IsBudgetPaymentBlock(nBlockHeight)){
if(IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(nBlockHeight)){
return budget.GetRequiredPaymentsString(nBlockHeight);
} else {
return masternodePayments.GetRequiredPaymentsString(nBlockHeight);

View File

@ -49,8 +49,8 @@ Value mnbudget(const Array& params, bool fHelp)
std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
mnEntries = masternodeConfig.getEntries();
if (params.size() != 7 && params.size() != 8)
throw runtime_error("Correct usage is 'mnbudget prepare proposal-name url payment_count block_start dash_address monthly_payment_dash [use_ix(true|false)]'");
if (params.size() != 7)
throw runtime_error("Correct usage is 'mnbudget prepare proposal-name url payment_count block_start dash_address monthly_payment_dash'");
std::string strProposalName = params[1].get_str();
if(strProposalName.size() > 20)