Skip to content

Commit

Permalink
Add CheckString for proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
panleone committed Mar 30, 2023
1 parent 4df4ca8 commit 11c279c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/budget/budgetproposal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "budget/budgetproposal.h"
#include "chainparams.h"
#include "logging.h"
#include "script/standard.h"
#include "utilstrencodings.h"

Expand Down Expand Up @@ -146,9 +147,6 @@ bool CBudgetProposal::CheckAddress(const int nCurrentHeight)
return true;
}

/* TODO: Add this to IsWellFormed() for the next hard-fork
* This will networkly reject malformed proposal names and URLs
*/
bool CBudgetProposal::CheckStrings()
{
if (strProposalName != SanitizeString(strProposalName)) {
Expand All @@ -157,11 +155,17 @@ bool CBudgetProposal::CheckStrings()
}
if (strURL != SanitizeString(strURL)) {
strInvalid = "Proposal URL contains illegal characters.";
return false;
}
return true;
}

bool CBudgetProposal::IsWellFormed(const CAmount& nTotalBudget, const int nCurrentHeight)
{
bool isV6Enforced = Params().GetConsensus().NetworkUpgradeActive(nCurrentHeight, Consensus::UPGRADE_V6_0);
if (isV6Enforced && !CheckStrings()) {
return false;
}
return CheckStartEnd() && CheckAmount(nTotalBudget) && CheckAddress(nCurrentHeight);
}

Expand Down

0 comments on commit 11c279c

Please sign in to comment.