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,6 +232,7 @@ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight)
} }
//check if it's a budget block //check if it's a budget block
if(IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS)){
if(budget.IsBudgetPaymentBlock(nBlockHeight)){ if(budget.IsBudgetPaymentBlock(nBlockHeight)){
if(budget.IsTransactionValid(txNew, nBlockHeight)){ if(budget.IsTransactionValid(txNew, nBlockHeight)){
return true; return true;
@ -245,6 +246,7 @@ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight)
} }
} }
} }
}
//check for masternode payee //check for masternode payee
if(masternodePayments.IsTransactionValid(txNew, nBlockHeight)) if(masternodePayments.IsTransactionValid(txNew, nBlockHeight))
@ -269,7 +271,7 @@ void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees)
CBlockIndex* pindexPrev = chainActive.Tip(); CBlockIndex* pindexPrev = chainActive.Tip();
if(!pindexPrev) return; if(!pindexPrev) return;
if(budget.IsBudgetPaymentBlock(pindexPrev->nHeight+1)){ if(IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(pindexPrev->nHeight+1)){
budget.FillBlockPayee(txNew, nFees); budget.FillBlockPayee(txNew, nFees);
} else { } else {
masternodePayments.FillBlockPayee(txNew, nFees); masternodePayments.FillBlockPayee(txNew, nFees);
@ -278,7 +280,7 @@ void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees)
std::string GetRequiredPaymentsString(int nBlockHeight) std::string GetRequiredPaymentsString(int nBlockHeight)
{ {
if(budget.IsBudgetPaymentBlock(nBlockHeight)){ if(IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(nBlockHeight)){
return budget.GetRequiredPaymentsString(nBlockHeight); return budget.GetRequiredPaymentsString(nBlockHeight);
} else { } else {
return masternodePayments.GetRequiredPaymentsString(nBlockHeight); return masternodePayments.GetRequiredPaymentsString(nBlockHeight);

View File

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