From f139dbbc74a33e11fd04bddfd3c3543e17077b9b Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Wed, 15 Jul 2015 15:56:40 -0700 Subject: [PATCH] Fixed prepare -- shouldn't check collateral --- src/masternode-budget.cpp | 16 ++++++++++------ src/masternode-budget.h | 4 ++-- src/rpcmasternode-budget.cpp | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/masternode-budget.cpp b/src/masternode-budget.cpp index df551b9f31..3e3607c24f 100644 --- a/src/masternode-budget.cpp +++ b/src/masternode-budget.cpp @@ -1000,7 +1000,7 @@ CBudgetProposal::CBudgetProposal(const CBudgetProposal& other) fValid = true; } -bool CBudgetProposal::IsValid(std::string& strError) +bool CBudgetProposal::IsValid(std::string& strError, bool fCheckCollateral) { if(GetYeas()-GetNays() < -(mnodeman.CountEnabled()/10)){ strError = "Active removal"; @@ -1017,8 +1017,10 @@ bool CBudgetProposal::IsValid(std::string& strError) return false; } - if(!IsBudgetCollateralValid(nFeeTXHash, GetHash(), strError)){ - return false; + if(fCheckCollateral){ + if(!IsBudgetCollateralValid(nFeeTXHash, GetHash(), strError)){ + return false; + } } //if proposal doesn't gain traction within 2 weeks, remove it @@ -1422,7 +1424,7 @@ std::string CFinalizedBudget::GetStatus() return retBadHashes + retBadPayeeOrAmount; } -bool CFinalizedBudget::IsValid() +bool CFinalizedBudget::IsValid(bool fCheckCollateral) { //must be the correct block for payment to happen (once a month) if(nBlockStart % GetBudgetPaymentCycleBlocks() != 0) return false; @@ -1436,8 +1438,10 @@ bool CFinalizedBudget::IsValid() if(GetTotalPayout() > budget.GetTotalBudget(nBlockStart)) return false; std::string strError = ""; - if(!IsBudgetCollateralValid(nFeeTXHash, GetHash(), strError)){ - return false; + if(fCheckCollateral){ + if(!IsBudgetCollateralValid(nFeeTXHash, GetHash(), strError)){ + return false; + } } //TODO: if N cycles old, invalid, invalid diff --git a/src/masternode-budget.h b/src/masternode-budget.h index 1595607760..014b44eba8 100644 --- a/src/masternode-budget.h +++ b/src/masternode-budget.h @@ -203,7 +203,7 @@ public: double GetScore(); bool HasMinimumRequiredSupport(); - bool IsValid(); + bool IsValid(bool fCheckCollateral=true); std::string GetName() {return strBudgetName; } std::string GetProposals(); @@ -368,7 +368,7 @@ public: bool HasMinimumRequiredSupport(); std::pair GetVotes(); - bool IsValid(std::string& strError); + bool IsValid(std::string& strError, bool fCheckCollateral=true); std::string GetName() {return strProposalName; } std::string GetURL() {return strURL; } diff --git a/src/rpcmasternode-budget.cpp b/src/rpcmasternode-budget.cpp index efaf39f624..10653f2efc 100644 --- a/src/rpcmasternode-budget.cpp +++ b/src/rpcmasternode-budget.cpp @@ -95,7 +95,7 @@ Value mnbudget(const Array& params, bool fHelp) CBudgetProposalBroadcast budgetProposalBroadcast(strProposalName, strURL, nPaymentCount, scriptPubKey, nAmount, nBlockStart, 0); std::string strError = ""; - if(!budgetProposalBroadcast.IsValid(strError)) + if(!budgetProposalBroadcast.IsValid(strError, false)) return "Proposal is not valid - " + budgetProposalBroadcast.GetHash().ToString() + " - " + strError; std::string cmd = "tx";