Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cleanup] Remove and deglobalize system.h global variables. #2569

Merged
merged 3 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,12 @@ OperationResult initMasternode(const std::string& _strMasterNodePrivKey, const s
return errorOut("ERROR: Empty masternodeaddr");
}

// Global params set
strMasterNodeAddr = _strMasterNodeAddr;

// Address parsing.
const CChainParams& params = Params();
int nPort = 0;
int nDefaultPort = params.GetDefaultPort();
std::string strHost;
SplitHostPort(strMasterNodeAddr, nPort, strHost);
SplitHostPort(_strMasterNodeAddr, nPort, strHost);

// Allow for the port number to be omitted here and just double check
// that if a port is supplied, it matches the required default port.
Expand All @@ -254,7 +251,7 @@ OperationResult initMasternode(const std::string& _strMasterNodePrivKey, const s
}
CService addrTest(LookupNumeric(strHost.c_str(), nPort));
if (!addrTest.IsValid()) {
return errorOut(strprintf(_("Invalid -masternodeaddr address: %s"), strMasterNodeAddr));
return errorOut(strprintf(_("Invalid -masternodeaddr address: %s"), _strMasterNodeAddr));
}

// Peer port needs to match the masternode public one for IPv4 and IPv6.
Expand Down
3 changes: 3 additions & 0 deletions src/budget/budgetmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class CBudgetManager : public CValidationInterface
mutable RecursiveMutex cs_finalizedvotes;
mutable RecursiveMutex cs_votes;

// budget finalization
std::string strBudgetMode = "";

CBudgetManager() {}

void ClearSeen()
Expand Down
4 changes: 2 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1906,7 +1906,7 @@ bool AppInitMain()
}

//get the mode of budget voting for this masternode
strBudgetMode = gArgs.GetArg("-budgetvotemode", "auto");
g_budgetman.strBudgetMode = gArgs.GetArg("-budgetvotemode", "auto");

#ifdef ENABLE_WALLET
// !TODO: remove after complete transition to DMN
Expand Down Expand Up @@ -1940,7 +1940,7 @@ bool AppInitMain()
}

LogPrintf("fLiteMode %d\n", fLiteMode);
LogPrintf("Budget Mode %s\n", strBudgetMode.c_str());
LogPrintf("Budget Mode %s\n", g_budgetman.strBudgetMode.c_str());

threadGroup.create_thread(std::bind(&ThreadCheckMasternodes));

Expand Down
5 changes: 1 addition & 4 deletions src/pivxd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
* Use the buttons <code>Namespaces</code>, <code>Classes</code> or <code>Files</code> at the top of the page to start navigating the code.
*/

static bool fDaemon;

void WaitForShutdown()
{
while (!ShutdownRequested()) {
Expand Down Expand Up @@ -127,8 +125,7 @@ bool AppInit(int argc, char* argv[])
}

#ifndef WIN32
fDaemon = gArgs.GetBoolArg("-daemon", false);
if (fDaemon) {
if (gArgs.GetBoolArg("-daemon", false)) {
fprintf(stdout, "PIVX server starting\n");

// Daemonize
Expand Down
4 changes: 0 additions & 4 deletions src/util/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,10 @@ const char * const PIVX_MASTERNODE_CONF_FILENAME = "masternode.conf";
// PIVX only features
// Masternode
std::atomic<bool> fMasterNode{false};
std::string strMasterNodeAddr = "";
bool fLiteMode = false;
// budget finalization
std::string strBudgetMode = "";

ArgsManager gArgs;

bool fDaemon = false;
CTranslationInterface translationInterface;

bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes)
Expand Down
2 changes: 0 additions & 2 deletions src/util/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ extern const char * const DEFAULT_DEBUGLOGFILE;

extern std::atomic<bool> fMasterNode;
extern bool fLiteMode;
extern std::string strMasterNodeAddr;
extern std::string strBudgetMode;

extern CTranslationInterface translationInterface;

Expand Down