Skip to content

Commit

Permalink
[Budget] Make sorting of finalized budgets deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrs-X committed May 11, 2018
1 parent 9985266 commit 93e637f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/masternode-budget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,10 +844,13 @@ std::vector<CBudgetProposal*> CBudgetManager::GetBudget()
return vBudgetProposalsRet;
}

// Sort by votes, if there's a tie sort by their feeHash TX
struct sortFinalizedBudgetsByVotes {
bool operator()(const std::pair<CFinalizedBudget*, int>& left, const std::pair<CFinalizedBudget*, int>& right)
{
return left.second > right.second;
if (left.second != right.second)
return left.second > right.second;
return (left.first->nFeeTXHash > right.first->nFeeTXHash);
}
};

Expand Down

0 comments on commit 93e637f

Please sign in to comment.