Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

util.cpp File Reference
#include <util.h>
#include <fs.h>
#include <support/allocators/secure.h>
#include <chainparamsbase.h>
#include <ctpl.h>
#include <random.h>
#include <serialize.h>
#include <stacktraces.h>
#include <utilstrencodings.h>
#include <stdarg.h>
#include <algorithm>
#include <fcntl.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/program_options/detail/config_file.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/thread.hpp>
#include <openssl/crypto.h>
#include <openssl/rand.h>
#include <openssl/conf.h>
+ Include dependency graph for util.cpp:

Go to the source code of this file.

Classes

class  CInit
 
struct  CLogCategoryDesc
 
class  ArgsManagerHelper
 Internal helper functions for ArgsManager. More...
 

Functions

std::atomic< bool > fReopenDebugLog (false)
 
std::atomic< uint64_t > logCategories (0)
 Log categories bitfield. More...
 
void locking_callback (int mode, int i, const char *file, int line) NO_THREAD_SAFETY_ANALYSIS
 
static int FileWriteStr (const std::string &str, FILE *fp)
 
static void DebugPrintInit ()
 
fs::path GetDebugLogPath ()
 
bool OpenDebugLog ()
 
bool GetLogCategory (uint64_t *f, const std::string *str)
 Return true if str parses as a log category and set the flags in f. More...
 
std::string ListLogCategories ()
 Returns a string with the log categories. More...
 
std::vector< CLogCategoryActiveListActiveLogCategories ()
 Returns a vector of the active log categories. More...
 
std::string ListActiveLogCategoriesString ()
 Returns a string with the list of active log categories. More...
 
static std::string LogTimestampStr (const std::string &str, std::atomic_bool *fStartedNewLine)
 fStartedNewLine is a state variable held by the calling context that will suppress printing of the timestamp when multiple calls are made that don't end in a newline. More...
 
static std::string LogThreadNameStr (const std::string &str, std::atomic_bool *fStartedNewLine)
 fStartedNewLine is a state variable held by the calling context that will suppress printing of the thread name when multiple calls are made that don't end in a newline. More...
 
int LogPrintStr (const std::string &str)
 Send a string to the log output. More...
 
bool LockDirectory (const fs::path &directory, const std::string lockfile_name, bool probe_only)
 
void ReleaseDirectoryLocks ()
 Release all directory locks. More...
 
static bool InterpretBool (const std::string &strValue)
 Interpret a string argument as a boolean. More...
 
static bool InterpretNegatedOption (std::string &key, std::string &val)
 Interpret -nofoo as if the user supplied -foo=0. More...
 
std::string HelpMessageGroup (const std::string &message)
 Format a string to be used as group of options in help messages. More...
 
std::string HelpMessageOpt (const std::string &option, const std::string &message)
 Format a string to be used as option description in help messages. More...
 
void PrintExceptionContinue (const std::exception_ptr pex, const char *pszExceptionOrigin)
 
fs::path GetDefaultDataDir ()
 
const fs::path & GetDataDir (bool fNetSpecific)
 
fs::path GetBackupsDir ()
 
void ClearDatadirCache ()
 
fs::path GetConfigFile (const std::string &confPath)
 
fs::path GetPidFile ()
 
void CreatePidFile (const fs::path &path, pid_t pid)
 
bool RenameOver (fs::path src, fs::path dest)
 
bool TryCreateDirectories (const fs::path &p)
 Ignores exceptions thrown by Boost's create_directories if the requested directory exists. More...
 
void FileCommit (FILE *file)
 
bool TruncateFile (FILE *file, unsigned int length)
 
int RaiseFileDescriptorLimit (int nMinFD)
 this function tries to raise the file descriptor limit to the requested number. More...
 
void AllocateFileRange (FILE *file, unsigned int offset, unsigned int length)
 this function tries to make a particular range of a file allocated (corresponding to disk space) it is advisory, and the range specified in the arguments will never contain live data More...
 
void ShrinkDebugFile ()
 
void runCommand (const std::string &strCommand)
 
void RenameThread (const char *name)
 
std::string GetThreadName ()
 
void RenameThreadPool (ctpl::thread_pool &tp, const char *baseName)
 
void SetupEnvironment ()
 
bool SetupNetworking ()
 
int GetNumCores ()
 Return the number of physical cores available on the current system. More...
 
std::string CopyrightHolders (const std::string &strPrefix, unsigned int nStartYear, unsigned int nEndYear)
 
uint32_t StringVersionToInt (const std::string &strVersion)
 Converts version strings to 4-byte unsigned integer. More...
 
std::string IntVersionToString (uint32_t nVersion)
 Converts version as 4-byte unsigned integer to string. More...
 
std::string SafeIntVersionToString (uint32_t nVersion)
 Copy of the IntVersionToString, that returns "Invalid version" string instead of throwing std::bad_cast. More...
 
int64_t GetStartupTime ()
 
fs::path AbsPathForConfigVal (const fs::path &path, bool net_specific)
 Most paths passed as configuration arguments are treated as relative to the datadir if they are not absolute. More...
 

Variables

const int64_t nStartupTime = GetTime()
 
bool fMasternodeMode = false
 
bool fDisableGovernance = false
 
int nWalletBackups = 10
 nWalletBackups: 1..10 - number of automatic backups to keep 0 - disabled by command-line -1 - disabled because of some error during run-time -2 - disabled because wallet was locked and we were not able to replenish keypool More...
 
const char *const BITCOIN_CONF_FILENAME = "dash.conf"
 
const char *const BITCOIN_PID_FILENAME = "dashd.pid"
 
const char *const DEFAULT_DEBUGLOGFILE = "debug.log"
 
ArgsManager gArgs
 
bool fPrintToConsole = false
 
bool fPrintToDebugLog = true
 
bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS
 
bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS
 
bool fLogThreadNames = DEFAULT_LOGTHREADNAMES
 
bool fLogIPs = DEFAULT_LOGIPS
 
CTranslationInterface translationInterface
 
static std::unique_ptr< CCriticalSection[]> ppmutexOpenSSL
 Init OpenSSL library multithreading support. More...
 
class CInit instance_of_cinit
 
static boost::once_flag debugPrintInitFlag = BOOST_ONCE_INIT
 LogPrintf() has been broken a couple of times now by well-meaning people adding mutexes in the most straightforward way. More...
 
static FILE * fileout = nullptr
 We use boost::call_once() to make sure mutexDebugLog and vMsgsBeforeOpenLog are initialized in a thread-safe manner. More...
 
static boost::mutex * mutexDebugLog = nullptr
 
static std::list< std::string > * vMsgsBeforeOpenLog
 
const CLogCategoryDesc LogCategories []
 
static std::map< std::string, std::unique_ptr< boost::interprocess::file_lock > > dir_locks
 A map that contains all the currently held directory locks. More...
 
static std::mutex cs_dir_locks
 Mutex to protect dir_locks. More...
 
static const int screenWidth = 79
 
static const int optIndent = 2
 
static const int msgIndent = 7
 
static fs::path pathCached
 
static fs::path pathCachedNetSpecific
 
static CCriticalSection csPathCached
 

Function Documentation

◆ AbsPathForConfigVal()

fs::path AbsPathForConfigVal ( const fs::path &  path,
bool  net_specific = true 
)

Most paths passed as configuration arguments are treated as relative to the datadir if they are not absolute.

Parameters
pathThe path to be conditionally prefixed with datadir.
net_specificForwarded to GetDataDir().
Returns
The normalized path.

Definition at line 1434 of file util.cpp.

References GetDataDir().

Referenced by GetAuthCookieFile(), GetConfigFile(), GetDebugLogPath(), and GetPidFile().

◆ AllocateFileRange()

void AllocateFileRange ( FILE *  file,
unsigned int  offset,
unsigned int  length 
)

this function tries to make a particular range of a file allocated (corresponding to disk space) it is advisory, and the range specified in the arguments will never contain live data

Definition at line 1151 of file util.cpp.

Referenced by FindBlockPos(), and FindUndoPos().

◆ ClearDatadirCache()

void ClearDatadirCache ( )

Definition at line 968 of file util.cpp.

References csPathCached, LOCK, pathCached, and pathCachedNetSpecific.

Referenced by ArgsManager::ReadConfigFile().

◆ CopyrightHolders()

std::string CopyrightHolders ( const std::string &  strPrefix,
unsigned int  nStartYear,
unsigned int  nEndYear 
)

Definition at line 1364 of file util.cpp.

References _(), and strprintf.

Referenced by LicenseInfo().

◆ CreatePidFile()

void CreatePidFile ( const fs::path &  path,
pid_t  pid 
)

Definition at line 1058 of file util.cpp.

References fsbridge::fopen().

Referenced by AppInitMain().

◆ DebugPrintInit()

static void DebugPrintInit ( )
static

Definition at line 201 of file util.cpp.

References mutexDebugLog, and vMsgsBeforeOpenLog.

Referenced by LogPrintStr(), and OpenDebugLog().

◆ FileCommit()

void FileCommit ( FILE *  file)

Definition at line 1099 of file util.cpp.

Referenced by DumpMempool(), and FlushBlockFile().

◆ FileWriteStr()

static int FileWriteStr ( const std::string &  str,
FILE *  fp 
)
static

Definition at line 196 of file util.cpp.

Referenced by LogPrintStr(), and OpenDebugLog().

◆ fReopenDebugLog()

std::atomic<bool> fReopenDebugLog ( false  )

Referenced by LogPrintStr().

◆ GetBackupsDir()

fs::path GetBackupsDir ( )

◆ GetConfigFile()

fs::path GetConfigFile ( const std::string &  confPath)

◆ GetDataDir()

◆ GetDebugLogPath()

fs::path GetDebugLogPath ( )

◆ GetDefaultDataDir()

fs::path GetDefaultDataDir ( )

Definition at line 898 of file util.cpp.

Referenced by AppInitMain(), GetDataDir(), and Intro::getDefaultDataDirectory().

◆ GetLogCategory()

bool GetLogCategory ( uint64_t *  f,
const std::string *  str 
)

◆ GetNumCores()

int GetNumCores ( )

Return the number of physical cores available on the current system.

Note
This does not count virtual cores, such as those provided by HyperThreading when boost is newer than 1.56.

Definition at line 1355 of file util.cpp.

Referenced by AppInitParameterInteraction(), CCheckQueueSpeed(), CCheckQueueSpeedPrevectorJob(), HelpMessage(), and OptionsDialog::OptionsDialog().

◆ GetPidFile()

fs::path GetPidFile ( )

Definition at line 1053 of file util.cpp.

References AbsPathForConfigVal(), BITCOIN_PID_FILENAME, gArgs, and ArgsManager::GetArg().

Referenced by AppInitMain(), and PrepareShutdown().

◆ GetStartupTime()

int64_t GetStartupTime ( )

Definition at line 1429 of file util.cpp.

References nStartupTime.

Referenced by ClientModel::formatClientStartupTime(), and uptime().

◆ GetThreadName()

std::string GetThreadName ( )

Definition at line 1261 of file util.cpp.

References name.

Referenced by LogThreadNameStr().

◆ HelpMessageGroup()

std::string HelpMessageGroup ( const std::string &  message)

Format a string to be used as group of options in help messages.

Parameters
messageGroup name (e.g. "RPC server options:")
Returns
the formatted string

Definition at line 880 of file util.cpp.

Referenced by AppendParamsHelpMessages(), AppInitRawTx(), WalletInit::GetHelpString(), HelpMessage(), HelpMessageCli(), and HelpMessageDialog::HelpMessageDialog().

◆ HelpMessageOpt()

std::string HelpMessageOpt ( const std::string &  option,
const std::string &  message 
)

Format a string to be used as option description in help messages.

Parameters
optionOption message (e.g. "-rpcuser=<user>")
messageOption description (e.g. "Username for JSON-RPC connections")
Returns
the formatted string

Definition at line 884 of file util.cpp.

References FormatParagraph(), msgIndent, optIndent, and screenWidth.

Referenced by AppendParamsHelpMessages(), AppInitRawTx(), WalletInit::GetHelpString(), HelpMessage(), HelpMessageCli(), and HelpMessageDialog::HelpMessageDialog().

◆ InterpretBool()

static bool InterpretBool ( const std::string &  strValue)
static

Interpret a string argument as a boolean.

The definition of atoi() requires that non-numeric string values like "foo", return 0. This means that if a user unintentionally supplies a non-integer argument here, the return value is always false. This means that -foo=false does what the user probably expects, but -foo=true is well defined but does not do what they probably expected.

The return value of atoi() is undefined when given input not representable as an int. On most systems this means string value between "-2147483648" and "2147483647" are well defined (this method will return true). Setting -txindex=2147483648 on most systems, however, is probably undefined.

For a more extensive discussion of this topic (and a wide range of opinions on the Right Way to change this code), see PR12713.

Definition at line 529 of file util.cpp.

References atoi().

Referenced by ArgsManager::GetBoolArg(), ArgsManagerHelper::GetNetBoolArg(), and InterpretNegatedOption().

◆ InterpretNegatedOption()

static bool InterpretNegatedOption ( std::string &  key,
std::string &  val 
)
static

Interpret -nofoo as if the user supplied -foo=0.

This method also tracks when the -no form was supplied, and if so, checks whether there was a double-negative (-nofoo=0 -> -foo=1).

If there was not a double negative, it removes the "no" from the key, and returns true, indicating the caller should clear the args vector to indicate a negated option.

If there was a double negative, it removes "no" from the key, sets the value to "1" and returns false.

If there was no "no", it leaves key and value untouched and returns false.

Where an option was negated can be later checked using the IsArgNegated() method. One use case for this is to have a way to disable options that are not normally boolean (e.g. using -nodebuglogfile to request that debug log output is not sent to any file at all).

Definition at line 657 of file util.cpp.

References InterpretBool(), and LogPrintf.

Referenced by ArgsManager::ParseParameters(), and ArgsManager::ReadConfigStream().

◆ IntVersionToString()

std::string IntVersionToString ( uint32_t  nVersion)

Converts version as 4-byte unsigned integer to string.

Parameters
nVersion4-byte unsigned integer, most significant byte is always 0
Returns
version string in "x.x.x" format (last 3 bytes as version parts) Throws std::bad_cast if format doesn match.

Definition at line 1399 of file util.cpp.

Referenced by SafeIntVersionToString().

◆ ListActiveLogCategories()

std::vector<CLogCategoryActive> ListActiveLogCategories ( )

Returns a vector of the active log categories.

Definition at line 337 of file util.cpp.

References CLogCategoryActive::active, BCLog::ALL, ARRAYLEN, CLogCategoryActive::category, CLogCategoryDesc::category, LogAcceptCategory(), LogCategories, and BCLog::NONE.

Referenced by logging().

◆ ListActiveLogCategoriesString()

std::string ListActiveLogCategoriesString ( )

Returns a string with the list of active log categories.

Definition at line 352 of file util.cpp.

References BCLog::ALL, ARRAYLEN, CLogCategoryDesc::category, LogAcceptCategory(), logCategories(), LogCategories, and BCLog::NONE.

Referenced by debug().

◆ ListLogCategories()

std::string ListLogCategories ( )

Returns a string with the log categories.

Definition at line 322 of file util.cpp.

References BCLog::ALL, ARRAYLEN, CLogCategoryDesc::category, LogCategories, and BCLog::NONE.

Referenced by debug(), HelpMessage(), and logging().

◆ LockDirectory()

bool LockDirectory ( const fs::path &  directory,
const std::string  lockfile_name,
bool  probe_only 
)

Definition at line 477 of file util.cpp.

References cs_dir_locks, dir_locks, error(), and fsbridge::fopen().

Referenced by LockDataDirectory(), and BerkeleyEnvironment::Open().

◆ locking_callback()

void locking_callback ( int  mode,
int  i,
const char *  file,
int  line 
)

Definition at line 124 of file util.cpp.

References ENTER_CRITICAL_SECTION, LEAVE_CRITICAL_SECTION, and ppmutexOpenSSL.

Referenced by CInit::CInit().

◆ logCategories()

std::atomic<uint64_t> logCategories ( )

Log categories bitfield.

Referenced by ListActiveLogCategoriesString().

◆ LogPrintStr()

int LogPrintStr ( const std::string &  str)

◆ LogThreadNameStr()

static std::string LogThreadNameStr ( const std::string &  str,
std::atomic_bool *  fStartedNewLine 
)
static

fStartedNewLine is a state variable held by the calling context that will suppress printing of the thread name when multiple calls are made that don't end in a newline.

Initialize it to true, and hold/manage it, in the calling context.

Definition at line 405 of file util.cpp.

References fLogThreadNames, GetThreadName(), and strprintf.

Referenced by LogPrintStr().

◆ LogTimestampStr()

static std::string LogTimestampStr ( const std::string &  str,
std::atomic_bool *  fStartedNewLine 
)
static

fStartedNewLine is a state variable held by the calling context that will suppress printing of the timestamp when multiple calls are made that don't end in a newline.

Initialize it to true, and hold/manage it, in the calling context.

Definition at line 377 of file util.cpp.

References DateTimeStrFormat(), fLogTimeMicros, fLogTimestamps, GetMockTime(), GetTimeMicros(), and strprintf.

Referenced by LogPrintStr().

◆ OpenDebugLog()

bool OpenDebugLog ( )

◆ PrintExceptionContinue()

void PrintExceptionContinue ( const std::exception_ptr  pex,
const char *  pszExceptionOrigin 
)

◆ RaiseFileDescriptorLimit()

int RaiseFileDescriptorLimit ( int  nMinFD)

this function tries to raise the file descriptor limit to the requested number.

It returns the actual file descriptor limit (which may be more or less than nMinFD)

Definition at line 1128 of file util.cpp.

Referenced by AppInitParameterInteraction().

◆ ReleaseDirectoryLocks()

void ReleaseDirectoryLocks ( )

Release all directory locks.

This is used for unit testing only, at runtime the global destructor will take care of the locks.

Definition at line 506 of file util.cpp.

References cs_dir_locks, and dir_locks.

◆ RenameOver()

bool RenameOver ( fs::path  src,
fs::path  dest 
)

Definition at line 1069 of file util.cpp.

Referenced by DumpMempool(), GenerateAuthCookie(), and ThreadImport().

◆ RenameThread()

void RenameThread ( const char *  name)

◆ RenameThreadPool()

void RenameThreadPool ( ctpl::thread_pool tp,
const char *  baseName 
)

◆ runCommand()

void runCommand ( const std::string &  strCommand)

◆ SafeIntVersionToString()

std::string SafeIntVersionToString ( uint32_t  nVersion)

Copy of the IntVersionToString, that returns "Invalid version" string instead of throwing std::bad_cast.

Parameters
nVersion4-byte unsigned integer, most significant byte is always 0
Returns
version string in "x.x.x" format (last 3 bytes as version parts) or "Invalid version" if can't cast the given value

Definition at line 1415 of file util.cpp.

References IntVersionToString().

◆ SetupEnvironment()

void SetupEnvironment ( )

Definition at line 1314 of file util.cpp.

Referenced by main().

◆ SetupNetworking()

bool SetupNetworking ( )

Definition at line 1343 of file util.cpp.

Referenced by AppInitBasicSetup(), and main().

◆ ShrinkDebugFile()

void ShrinkDebugFile ( )

Definition at line 1193 of file util.cpp.

References fsbridge::fopen(), and GetDebugLogPath().

Referenced by AppInitMain().

◆ StringVersionToInt()

uint32_t StringVersionToInt ( const std::string &  strVersion)

Converts version strings to 4-byte unsigned integer.

Parameters
strVersionversion in "x.x.x" format (decimal digits only)
Returns
4-byte unsigned integer, most significant byte is always 0 Throws std::bad_cast if format doesn match.

Definition at line 1379 of file util.cpp.

◆ TruncateFile()

bool TruncateFile ( FILE *  file,
unsigned int  length 
)

Definition at line 1116 of file util.cpp.

Referenced by FlushBlockFile().

◆ TryCreateDirectories()

bool TryCreateDirectories ( const fs::path &  p)

Ignores exceptions thrown by Boost's create_directories if the requested directory exists.

Specifically handles case where path p exists, but it wasn't possible for the user to write to the parent directory.

Definition at line 1085 of file util.cpp.

Referenced by CDBWrapper::CDBWrapper(), BerkeleyEnvironment::Open(), and Intro::pickDataDirectory().

Variable Documentation

◆ BITCOIN_CONF_FILENAME

const char* const BITCOIN_CONF_FILENAME = "dash.conf"

◆ BITCOIN_PID_FILENAME

const char* const BITCOIN_PID_FILENAME = "dashd.pid"

Definition at line 105 of file util.cpp.

Referenced by GetPidFile(), and HelpMessage().

◆ cs_dir_locks

std::mutex cs_dir_locks
static

Mutex to protect dir_locks.

Definition at line 475 of file util.cpp.

Referenced by LockDirectory(), and ReleaseDirectoryLocks().

◆ csPathCached

CCriticalSection csPathCached
static

Definition at line 926 of file util.cpp.

Referenced by ClearDatadirCache(), and GetDataDir().

◆ debugPrintInitFlag

boost::once_flag debugPrintInitFlag = BOOST_ONCE_INIT
static

LogPrintf() has been broken a couple of times now by well-meaning people adding mutexes in the most straightforward way.

It breaks because it may be called by global destructors during shutdown. Since the order of destruction of static/global objects is undefined, defining a mutex as a global object doesn't work (the mutex gets destroyed, and then some later destructor calls OutputDebugStringF, maybe indirectly, and you get a core dump at shutdown trying to lock the mutex).

Definition at line 181 of file util.cpp.

Referenced by LogPrintStr(), and OpenDebugLog().

◆ DEFAULT_DEBUGLOGFILE

const char* const DEFAULT_DEBUGLOGFILE = "debug.log"

Definition at line 106 of file util.cpp.

Referenced by GetDebugLogPath(), and HelpMessage().

◆ dir_locks

std::map<std::string, std::unique_ptr<boost::interprocess::file_lock> > dir_locks
static

A map that contains all the currently held directory locks.

After successful locking, these will be held here until the global destructor cleans them up and thus automatically unlocks them, or ReleaseDirectoryLocks is called.

Definition at line 473 of file util.cpp.

Referenced by LockDirectory(), and ReleaseDirectoryLocks().

◆ fDisableGovernance

◆ fileout

FILE* fileout = nullptr
static

We use boost::call_once() to make sure mutexDebugLog and vMsgsBeforeOpenLog are initialized in a thread-safe manner.

NOTE: fileout, mutexDebugLog and sometimes vMsgsBeforeOpenLog are leaked on exit. This is ugly, but will be cleaned up by the OS/libc. When the shutdown sequence is fully audited and tested, explicit destruction of these objects can be implemented.

Definition at line 192 of file util.cpp.

Referenced by LogPrintStr(), OpenDebugLog(), CFlatDB< T >::Write(), TxConfirmStats::Write(), CBlockPolicyEstimator::Write(), and WriteBlockToDisk().

◆ fLogIPs

◆ fLogThreadNames

bool fLogThreadNames = DEFAULT_LOGTHREADNAMES

Definition at line 114 of file util.cpp.

Referenced by InitLogging(), and LogThreadNameStr().

◆ fLogTimeMicros

bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS

Definition at line 113 of file util.cpp.

Referenced by InitLogging(), and LogTimestampStr().

◆ fLogTimestamps

bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS

Definition at line 112 of file util.cpp.

Referenced by AppInitMain(), InitLogging(), and LogTimestampStr().

◆ fMasternodeMode

bool fMasternodeMode = false

Definition at line 93 of file util.cpp.

Referenced by CConnman::AcceptConnection(), CPrivateSendServer::AddEntry(), CPrivateSendServer::AddUserToExistingSession(), AppInitMain(), llmq::CSigningManager::AsyncSignIfMember(), CConnman::AttemptToEvictConnection(), CalculateObjectGetDataTime(), CPrivateSendServer::ChargeFees(), CPrivateSendServer::ChargeRandomFees(), CPrivateSendServer::CheckForCompleteQueue(), CPrivateSendServer::CheckPool(), CPrivateSendServer::CheckTimeout(), CPrivateSendClientSession::CheckTimeout(), CPrivateSendClientManager::CheckTimeout(), CPrivateSendServer::CommitFinalTransaction(), CPrivateSendClientSession::CompletedTransaction(), CPrivateSendServer::CreateNewSession(), CPrivateSendClientSession::DoAutomaticDenominating(), CPrivateSendClientManager::DoAutomaticDenominating(), CPrivateSendServer::DoMaintenance(), CPrivateSendClientManager::DoMaintenance(), getprivatesendinfo(), CPrivateSendServer::HasTimedOut(), CActiveMasternodeManager::Init(), CPrivateSendServer::IsAcceptableDSA(), masternode_status(), PrepareShutdown(), OverviewPage::privateSendStatus(), CPrivateSendServer::ProcessMessage(), CPrivateSendClientSession::ProcessMessage(), CPrivateSendClientManager::ProcessMessage(), llmq::CSigSharesManager::ProcessMessage(), ProcessMessage(), CPrivateSendClientSession::ProcessPoolStateUpdate(), CMasternodeSync::ProcessTick(), llmq::CInstantSendManager::ProcessTx(), CMNAuth::PushMNAUTH(), quorum_dkgstatus(), CGovernanceManager::RequestGovernanceObjectVotes(), CWallet::SelectCoinsGroupedByAddresses(), CPrivateSendClientSession::SendDenominate(), PeerLogicValidation::SendMessages(), CPrivateSendServer::SetState(), CPrivateSendQueue::Sign(), CPrivateSendBroadcastTx::Sign(), CPrivateSendClientSession::SignFinalTransaction(), WalletInit::Start(), ThreadImport(), llmq::CChainLocksHandler::TrySignChainTip(), CActiveMasternodeManager::UpdatedBlockTip(), and CPrivateSendClientManager::UpdatedSuccessBlock().

◆ fPrintToConsole

bool fPrintToConsole = false

Definition at line 109 of file util.cpp.

Referenced by InitLogging(), and LogPrintStr().

◆ fPrintToDebugLog

bool fPrintToDebugLog = true

Definition at line 110 of file util.cpp.

Referenced by AppInitMain(), InitLogging(), LogPrintStr(), and main().

◆ gArgs

ArgsManager gArgs

Definition at line 108 of file util.cpp.

Referenced by AcceptToMemoryPoolWorker(), CChainState::ActivateBestChain(), OptionsModel::addOverriddenOption(), AddTimeData(), BlockAssembler::AddToBlock(), AddToCompactExtraTransactions(), CWallet::AddToWallet(), AdvertiseLocal(), AlertNotify(), AppInit(), AppInitBasicSetup(), AppInitMain(), AppInitParameterInteraction(), AppInitRawTx(), AppInitRPC(), AppInitServers(), TorController::auth_cb(), CConnman::Ban(), CCoinsViewDB::BatchWrite(), BitcoinGUI::BitcoinGUI(), BlockNotifyCallback(), CallRPC(), CDBWrapper::CDBWrapper(), CWallet::ChangeWalletPassphrase(), llmq::CSigningManager::Cleanup(), CommandLineRPC(), CZMQNotificationInterface::Create(), CreateBaseChainParams(), BlockAssembler::CreateNewBlock(), CWallet::CreateTransaction(), CWallet::CreateWalletFromFile(), DefaultOptions(), CWallet::EncryptWallet(), llmq::CQuorumManager::EnsureQuorumConnections(), FindDevNetGenesisBlock(), BerkeleyBatch::Flush(), FlushStateToDisk(), CWallet::GenerateNewHDChain(), GetAuthCookieFile(), GetBackupsDir(), getblockchaininfo(), GetDataDir(), GetDebugLogPath(), GUIUtil::getFont(), GetLangTerritory(), GetListenPort(), PaymentRequestPlus::getMerchant(), GetMinimumFee(), GetPidFile(), GetWalletDir(), GetWarnings(), llmq::CDKGSessionHandler::HandleDKGRound(), HelpExampleRpc(), HelpMessage(), HelpMessageDialog::HelpMessageDialog(), HTTPBindAddresses(), OptionsModel::Init(), CKeePassIntegrator::init(), CWallet::InitAutoBackup(), InitHTTPAllowList(), InitHTTPServer(), BitcoinApplication::initializeResult(), InitLogging(), InitParameterInteraction(), WalletInit::InitPrivateSendSettings(), InitRPCAuthentication(), InitScriptExecutionCache(), InitSignatureCache(), NetworkStyle::instantiate(), Intro::Intro(), IsDeprecatedRPCEnabled(), WalletModel::isWalletEnabled(), LoadBlockIndex(), GUIUtil::loadFonts(), LoadMempool(), PaymentServer::LoadRootCAs(), GUIUtil::loadStyleSheet(), WalletBatch::LoadWallet(), main(), MaybeCompactWalletDB(), mempoolInfoToJSON(), Misbehaving(), multiUserAuthorized(), CWallet::NotifyTransactionLock(), ObserveSafeMode(), WalletInit::Open(), BerkeleyEnvironment::Open(), GUIUtil::openConfigfile(), OutputTx(), WalletInit::ParameterInteraction(), Intro::pickDataDirectory(), DefaultRequestHandler::PrepareRequest(), PrepareShutdown(), CMNAuth::ProcessMessage(), ProcessMessage(), CMasternodeSync::ProcessTick(), TorController::protocolinfo_cb(), CMNAuth::PushMNAUTH(), ArgsManager::ReadConfigFile(), WalletInit::RegisterRPC(), RPCConsole::RPCConsole(), SelectBaseParams(), CWallet::SelectCoins(), OverviewPage::setBalance(), OverviewPage::setWalletModel(), CConnman::Start(), StartHTTPServer(), CConnman::ThreadDNSAddressSeed(), ThreadImport(), CConnman::ThreadOpenMasternodeConnections(), CWallet::TopUpKeyPool(), TorControlThread(), CWallet::Unlock(), UpdateMempoolForReorg(), WalletInit::Verify(), and verifychain().

◆ instance_of_cinit

class CInit instance_of_cinit

◆ LogCategories

const CLogCategoryDesc LogCategories[]

◆ msgIndent

const int msgIndent = 7
static

Definition at line 878 of file util.cpp.

Referenced by HelpMessageOpt().

◆ mutexDebugLog

boost::mutex* mutexDebugLog = nullptr
static

Definition at line 193 of file util.cpp.

Referenced by DebugPrintInit(), LogPrintStr(), and OpenDebugLog().

◆ nStartupTime

const int64_t nStartupTime = GetTime()

Definition at line 90 of file util.cpp.

Referenced by GetStartupTime().

◆ nWalletBackups

int nWalletBackups = 10

nWalletBackups: 1..10 - number of automatic backups to keep 0 - disabled by command-line -1 - disabled because of some error during run-time -2 - disabled because wallet was locked and we were not able to replenish keypool

Definition at line 102 of file util.cpp.

Referenced by CWallet::AutoBackupWallet(), CPrivateSendClientManager::CheckAutomaticBackup(), OverviewPage::DisablePrivateSendCompletely(), WalletInit::GetHelpString(), CWallet::InitAutoBackup(), CWallet::KeepKey(), OverviewPage::privateSendStatus(), and CWallet::Unlock().

◆ optIndent

const int optIndent = 2
static

Definition at line 877 of file util.cpp.

Referenced by HelpMessageOpt().

◆ pathCached

fs::path pathCached
static

Definition at line 924 of file util.cpp.

Referenced by ClearDatadirCache(), and GetDataDir().

◆ pathCachedNetSpecific

fs::path pathCachedNetSpecific
static

Definition at line 925 of file util.cpp.

Referenced by ClearDatadirCache(), and GetDataDir().

◆ ppmutexOpenSSL

std::unique_ptr<CCriticalSection[]> ppmutexOpenSSL
static

Init OpenSSL library multithreading support.

Definition at line 123 of file util.cpp.

Referenced by CInit::CInit(), locking_callback(), and CInit::~CInit().

◆ screenWidth

const int screenWidth = 79
static

Definition at line 876 of file util.cpp.

Referenced by HelpMessageOpt().

◆ translationInterface

CTranslationInterface translationInterface

Definition at line 117 of file util.cpp.

Referenced by _(), and main().

◆ vMsgsBeforeOpenLog

std::list<std::string>* vMsgsBeforeOpenLog
static

Definition at line 194 of file util.cpp.

Referenced by DebugPrintInit(), LogPrintStr(), and OpenDebugLog().

Released under the MIT license