From a102664d80d6442cde3a8587390fb384d8ff04e2 Mon Sep 17 00:00:00 2001 From: furszy Date: Tue, 22 Feb 2022 21:52:45 -0300 Subject: [PATCH] RPC, mnbudgetrawvote: use ProcessProposalVote instead of AddAndRelayProposalVote. And remove the now unused AddAndRelayProposalVote. --- src/budget/budgetmanager.cpp | 10 ---------- src/budget/budgetmanager.h | 2 -- src/rpc/budget.cpp | 6 +++--- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/budget/budgetmanager.cpp b/src/budget/budgetmanager.cpp index befa562823ee8..37c52d020afa4 100644 --- a/src/budget/budgetmanager.cpp +++ b/src/budget/budgetmanager.cpp @@ -901,16 +901,6 @@ CDataStream CBudgetManager::GetFinalizedBudgetSerialized(const uint256& budgetHa return mapFinalizedBudgets.at(budgetHash).GetBroadcast(); } -bool CBudgetManager::AddAndRelayProposalVote(const CBudgetVote& vote, std::string& strError) -{ - if (UpdateProposal(vote, nullptr, strError)) { - AddSeenProposalVote(vote); - vote.Relay(); - return true; - } - return false; -} - void CBudgetManager::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) { NewBlock(); diff --git a/src/budget/budgetmanager.h b/src/budget/budgetmanager.h index 5d98b3e66a1dc..26112205ba1f6 100644 --- a/src/budget/budgetmanager.h +++ b/src/budget/budgetmanager.h @@ -93,8 +93,6 @@ class CBudgetManager : public CValidationInterface CDataStream GetFinalizedBudgetVoteSerialized(const uint256& voteHash) const; CDataStream GetFinalizedBudgetSerialized(const uint256& budgetHash) const; - bool AddAndRelayProposalVote(const CBudgetVote& vote, std::string& strError); - // sets strProposal of a CFinalizedBudget reference void SetBudgetProposalsStr(CFinalizedBudget& finalizedBudget) const; diff --git a/src/rpc/budget.cpp b/src/rpc/budget.cpp index 22ab7c25b320d..b4e6a0f1b1ce2 100644 --- a/src/rpc/budget.cpp +++ b/src/rpc/budget.cpp @@ -527,11 +527,11 @@ UniValue mnbudgetrawvote(const JSONRPCRequest& request) return "Failure to verify signature."; } - std::string strError; - if (g_budgetman.AddAndRelayProposalVote(vote, strError)) { + CValidationState state; + if (g_budgetman.ProcessProposalVote(vote, nullptr, state)) { return "Voted successfully"; } else { - return "Error voting : " + strError; + return "Error voting : " + state.GetRejectReason() + ". " + state.GetDebugMessage(); } }