Skip to content

Commit b0c6dc1

Browse files
committed
Consensus: Budget: Fix instant killing of proposals
- raise the threshold required to 30% - never kill a proposal before its start
1 parent 84ca60a commit b0c6dc1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/budget/budgetproposal.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ void CBudgetProposal::SyncVotes(CNode* pfrom, bool fPartial, int& nInvCount) con
7979
}
8080
}
8181

82-
bool CBudgetProposal::IsHeavilyDownvoted()
82+
bool CBudgetProposal::IsHeavilyDownvoted(bool fNewRules)
8383
{
84-
if (GetNays() - GetYeas() > mnodeman.CountEnabled(ActiveProtocol()) / 10) {
85-
strInvalid = "Active removal";
84+
if (GetNays() - GetYeas() > (fNewRules ? 3 : 1) * mnodeman.CountEnabled(ActiveProtocol()) / 10) {
85+
strInvalid = "Heavily Downvoted";
8686
return true;
8787
}
8888
return false;
@@ -162,8 +162,12 @@ bool CBudgetProposal::UpdateValid(int nCurrentHeight)
162162
{
163163
fValid = false;
164164

165-
if (IsHeavilyDownvoted()) {
166-
return false;
165+
// !TODO: remove after v5 enforcement and use fixed multiplier (3)
166+
bool fNewRules = Params().GetConsensus().NetworkUpgradeActive(nCurrentHeight, Consensus::UPGRADE_V5_0);
167+
168+
// Never kill a proposal before the first superblock
169+
if (!fNewRules || nCurrentHeight > nBlockStart) {
170+
if (IsHeavilyDownvoted(fNewRules)) return false;
167171
}
168172

169173
if (IsExpired(nCurrentHeight)) {

src/budget/budgetproposal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CBudgetProposal
2727
std::string strInvalid;
2828

2929
// Functions used inside UpdateValid()/IsWellFormed - setting strInvalid
30-
bool IsHeavilyDownvoted();
30+
bool IsHeavilyDownvoted(bool fNewRules);
3131
bool IsExpired(int nCurrentHeight);
3232
bool CheckStartEnd();
3333
bool CheckAmount(const CAmount& nTotalBudget);

0 commit comments

Comments
 (0)