Skip to content

Commit bf995eb

Browse files
committed
[Cleanup] Remove unused active protocol argument in CountEnabled()
1 parent 34e1375 commit bf995eb

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/budget/budgetmanager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ bool CBudgetManager::GetFinalizedBudget(const uint256& nHash, CFinalizedBudget&
619619
bool CBudgetManager::IsBudgetPaymentBlock(int nBlockHeight, int& nCountThreshold) const
620620
{
621621
int nHighestCount = GetHighestVoteCount(nBlockHeight);
622-
int nCountEnabled = mnodeman.CountEnabled(ActiveProtocol());
622+
int nCountEnabled = mnodeman.CountEnabled();
623623
int nFivePercent = nCountEnabled / 20;
624624
// threshold for highest finalized budgets (highest vote count - 10% of active masternodes)
625625
nCountThreshold = nHighestCount - (nCountEnabled / 10);
@@ -712,7 +712,7 @@ std::vector<CBudgetProposal> CBudgetManager::GetBudget()
712712
const int nBlocksPerCycle = Params().GetConsensus().nBudgetCycleBlocks;
713713
int nBlockStart = nHeight - nHeight % nBlocksPerCycle + nBlocksPerCycle;
714714
int nBlockEnd = nBlockStart + nBlocksPerCycle - 1;
715-
int mnCount = mnodeman.CountEnabled(ActiveProtocol());
715+
int mnCount = mnodeman.CountEnabled();
716716
CAmount nTotalBudget = GetTotalBudget(nBlockStart);
717717

718718
for (CBudgetProposal* pbudgetProposal: vBudgetPorposalsSort) {
@@ -736,7 +736,7 @@ std::vector<CBudgetProposal> CBudgetManager::GetBudget()
736736
} else {
737737
LogPrint(BCLog::MNBUDGET,"%s: - Check 1 failed: valid=%d | %ld <= %ld | %ld >= %ld | Yeas=%d Nays=%d Count=%d | established=%d\n",
738738
__func__, pbudgetProposal->IsValid(), pbudgetProposal->GetBlockStart(), nBlockStart, pbudgetProposal->GetBlockEnd(),
739-
nBlockEnd, pbudgetProposal->GetYeas(), pbudgetProposal->GetNays(), mnodeman.CountEnabled(ActiveProtocol()) / 10,
739+
nBlockEnd, pbudgetProposal->GetYeas(), pbudgetProposal->GetNays(), mnodeman.CountEnabled() / 10,
740740
pbudgetProposal->IsEstablished());
741741
}
742742

src/budget/budgetproposal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void CBudgetProposal::SyncVotes(CNode* pfrom, bool fPartial, int& nInvCount) con
7979

8080
bool CBudgetProposal::IsHeavilyDownvoted(bool fNewRules)
8181
{
82-
if (GetNays() - GetYeas() > (fNewRules ? 3 : 1) * mnodeman.CountEnabled(ActiveProtocol()) / 10) {
82+
if (GetNays() - GetYeas() > (fNewRules ? 3 : 1) * mnodeman.CountEnabled() / 10) {
8383
strInvalid = "Heavily Downvoted";
8484
return true;
8585
}

src/masternodeman.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,10 @@ CMasternodeMan::MNsInfo CMasternodeMan::getMNsInfo() const
400400
return info;
401401
}
402402

403-
int CMasternodeMan::CountEnabled(int protocolVersion) const
403+
int CMasternodeMan::CountEnabled() const
404404
{
405405
int i = 0;
406-
protocolVersion = protocolVersion == -1 ? ActiveProtocol() : protocolVersion;
406+
int protocolVersion = ActiveProtocol();
407407

408408
for (const auto& it : mapMasternodes) {
409409
const MasternodeRef& mn = it.second;

src/masternodeman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class CMasternodeMan
126126
void SetBestHeight(int height) { nBestHeight.store(height, std::memory_order_release); };
127127
int GetBestHeight() const { return nBestHeight.load(std::memory_order_acquire); }
128128

129-
int CountEnabled(int protocolVersion = -1) const;
129+
int CountEnabled() const;
130130

131131
/// Count the number of nodes with a specific proto version for each network. Return the total.
132132
int CountNetworks(int& ipv4, int& ipv6, int& onion) const;

0 commit comments

Comments
 (0)