Skip to content

Commit 93e637f

Browse files
committed
[Budget] Make sorting of finalized budgets deterministic
1 parent 9985266 commit 93e637f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/masternode-budget.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,10 +844,13 @@ std::vector<CBudgetProposal*> CBudgetManager::GetBudget()
844844
return vBudgetProposalsRet;
845845
}
846846

847+
// Sort by votes, if there's a tie sort by their feeHash TX
847848
struct sortFinalizedBudgetsByVotes {
848849
bool operator()(const std::pair<CFinalizedBudget*, int>& left, const std::pair<CFinalizedBudget*, int>& right)
849850
{
850-
return left.second > right.second;
851+
if (left.second != right.second)
852+
return left.second > right.second;
853+
return (left.first->nFeeTXHash > right.first->nFeeTXHash);
851854
}
852855
};
853856

0 commit comments

Comments
 (0)