Skip to content

Commit

Permalink
RPC, mnbudgetrawvote: use ProcessProposalVote instead of AddAndRelayP…
Browse files Browse the repository at this point in the history
…roposalVote.

And remove the now unused AddAndRelayProposalVote.
  • Loading branch information
furszy committed Feb 23, 2022
1 parent 42bca64 commit a102664
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
10 changes: 0 additions & 10 deletions src/budget/budgetmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions src/budget/budgetmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions src/rpc/budget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit a102664

Please sign in to comment.