@@ -172,15 +172,15 @@ uint256 CBudgetManager::SubmitFinalBudget()
172172 return UINT256_ZERO;
173173 }
174174
175- std::vector<CBudgetProposal* > vBudgetProposals = GetBudget ();
175+ std::vector<CBudgetProposal> vBudgetProposals = GetBudget ();
176176 std::string strBudgetName = " main" ;
177177 std::vector<CTxBudgetPayment> vecTxBudgetPayments;
178178
179- for (auto & vBudgetProposal : vBudgetProposals) {
179+ for (const auto & p : vBudgetProposals) {
180180 CTxBudgetPayment txBudgetPayment;
181- txBudgetPayment.nProposalHash = vBudgetProposal-> GetHash ();
182- txBudgetPayment.payee = vBudgetProposal-> GetPayee ();
183- txBudgetPayment.nAmount = vBudgetProposal-> GetAllotted ();
181+ txBudgetPayment.nProposalHash = p. GetHash ();
182+ txBudgetPayment.payee = p. GetPayee ();
183+ txBudgetPayment.nAmount = p. GetAllotted ();
184184 vecTxBudgetPayments.push_back (txBudgetPayment);
185185 }
186186
@@ -710,7 +710,7 @@ void CBudgetManager::VoteOnFinalizedBudgets()
710710 return ;
711711 }
712712
713- std::vector<CBudgetProposal* > vBudget = GetBudget ();
713+ std::vector<CBudgetProposal> vBudget = GetBudget ();
714714 // Vector containing the hash of finalized budgets to save
715715 std::vector<uint256> vBudgetHashes;
716716 {
@@ -890,13 +890,13 @@ std::vector<CBudgetProposal*> CBudgetManager::GetAllProposals()
890890}
891891
892892// Need to review this function
893- std::vector<CBudgetProposal* > CBudgetManager::GetBudget ()
893+ std::vector<CBudgetProposal> CBudgetManager::GetBudget ()
894894{
895895 LOCK (cs_proposals);
896896
897897 int nHeight = GetBestHeight ();
898898 if (nHeight <= 0 )
899- return std::vector<CBudgetProposal* >();
899+ return std::vector<CBudgetProposal>();
900900
901901 // ------- Sort budgets by net Yes Count
902902 std::vector<CBudgetProposal*> vBudgetPorposalsSort;
@@ -907,7 +907,7 @@ std::vector<CBudgetProposal*> CBudgetManager::GetBudget()
907907 std::sort (vBudgetPorposalsSort.begin (), vBudgetPorposalsSort.end (), CBudgetProposal::PtrHigherYes);
908908
909909 // ------- Grab The Budgets In Order
910- std::vector<CBudgetProposal* > vBudgetProposalsRet;
910+ std::vector<CBudgetProposal> vBudgetProposalsRet;
911911 CAmount nBudgetAllocated = 0 ;
912912
913913 const int nBlocksPerCycle = Params ().GetConsensus ().nBudgetCycleBlocks ;
@@ -927,7 +927,7 @@ std::vector<CBudgetProposal*> CBudgetManager::GetBudget()
927927 if (pbudgetProposal->GetAmount () + nBudgetAllocated <= nTotalBudget) {
928928 pbudgetProposal->SetAllotted (pbudgetProposal->GetAmount ());
929929 nBudgetAllocated += pbudgetProposal->GetAmount ();
930- vBudgetProposalsRet.push_back (pbudgetProposal);
930+ vBudgetProposalsRet.push_back (* pbudgetProposal);
931931 LogPrint (BCLog::MNBUDGET," %s: - Check 2 passed: Budget added\n " , __func__);
932932 } else {
933933 pbudgetProposal->SetAllotted (0 );
@@ -1938,10 +1938,10 @@ struct sortProposalsByHash {
19381938 }
19391939};
19401940
1941- bool CFinalizedBudget::CheckProposals (std::vector<CBudgetProposal* >& vBudget) const
1941+ bool CFinalizedBudget::CheckProposals (std::vector<CBudgetProposal>& vBudget) const
19421942{
19431943 // Sort proposals by hash
1944- std::sort (vBudget.begin (), vBudget.end (), CBudgetProposal::PtrGreater );
1944+ std::sort (vBudget.begin (), vBudget.end (), std::greater<CBudgetProposal>() );
19451945
19461946 // Sort copy payments by hash (descending)
19471947 std::vector<CTxBudgetPayment> vecBudgetPaymentsSortedByHash (vecBudgetPayments);
@@ -1954,9 +1954,9 @@ bool CFinalizedBudget::CheckProposals(std::vector<CBudgetProposal*>& vBudget) co
19541954 }
19551955
19561956 for (unsigned int i = 0 ; i < vBudget.size (); i++) {
1957- LogPrint (BCLog::MNBUDGET," %s: Budget-Proposals - nProp %d %s\n " , __func__, i, vBudget[i]-> GetHash ().ToString ());
1958- LogPrint (BCLog::MNBUDGET," %s: Budget-Proposals - Payee %d %s\n " , __func__, i, HexStr (vBudget[i]-> GetPayee ()));
1959- LogPrint (BCLog::MNBUDGET," %s: Budget-Proposals - nAmount %d %lli\n " , __func__, i, vBudget[i]-> GetAmount ());
1957+ LogPrint (BCLog::MNBUDGET," %s: Budget-Proposals - nProp %d %s\n " , __func__, i, vBudget[i]. GetHash ().ToString ());
1958+ LogPrint (BCLog::MNBUDGET," %s: Budget-Proposals - Payee %d %s\n " , __func__, i, HexStr (vBudget[i]. GetPayee ()));
1959+ LogPrint (BCLog::MNBUDGET," %s: Budget-Proposals - nAmount %d %lli\n " , __func__, i, vBudget[i]. GetAmount ());
19601960 }
19611961
19621962 if (vBudget.size () == 0 ) {
@@ -1977,21 +1977,21 @@ bool CFinalizedBudget::CheckProposals(std::vector<CBudgetProposal*>& vBudget) co
19771977 return false ;
19781978 }
19791979
1980- if (vecBudgetPaymentsSortedByHash[i].nProposalHash != vBudget[i]-> GetHash ()) {
1980+ if (vecBudgetPaymentsSortedByHash[i].nProposalHash != vBudget[i]. GetHash ()) {
19811981 LogPrint (BCLog::MNBUDGET," %s: item #%d doesn't match %s %s\n " , __func__,
1982- i, vecBudgetPaymentsSortedByHash[i].nProposalHash .ToString (), vBudget[i]-> GetHash ().ToString ());
1982+ i, vecBudgetPaymentsSortedByHash[i].nProposalHash .ToString (), vBudget[i]. GetHash ().ToString ());
19831983 return false ;
19841984 }
19851985
1986- if (HexStr (vecBudgetPaymentsSortedByHash[i].payee ) != HexStr (vBudget[i]-> GetPayee ())) {
1986+ if (HexStr (vecBudgetPaymentsSortedByHash[i].payee ) != HexStr (vBudget[i]. GetPayee ())) {
19871987 LogPrint (BCLog::MNBUDGET," %s: item #%d payee doesn't match %s %s\n " , __func__,
1988- i, HexStr (vecBudgetPaymentsSortedByHash[i].payee ), HexStr (vBudget[i]-> GetPayee ()));
1988+ i, HexStr (vecBudgetPaymentsSortedByHash[i].payee ), HexStr (vBudget[i]. GetPayee ()));
19891989 return false ;
19901990 }
19911991
1992- if (vecBudgetPaymentsSortedByHash[i].nAmount != vBudget[i]-> GetAmount ()) {
1992+ if (vecBudgetPaymentsSortedByHash[i].nAmount != vBudget[i]. GetAmount ()) {
19931993 LogPrint (BCLog::MNBUDGET," %s: item #%d payee doesn't match %lli %lli\n " , __func__,
1994- i, vecBudgetPaymentsSortedByHash[i].nAmount , vBudget[i]-> GetAmount ());
1994+ i, vecBudgetPaymentsSortedByHash[i].nAmount , vBudget[i]. GetAmount ());
19951995 return false ;
19961996 }
19971997 }
0 commit comments