![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include "compat.h"
#include "tinyformat.h"
#include "utiltime.h"
#include "amount.h"
#include <exception>
#include <map>
#include <stdint.h>
#include <string>
#include <vector>
#include <boost/filesystem/path.hpp>
#include <boost/signals2/signal.hpp>
#include <boost/thread/exceptions.hpp>
Go to the source code of this file.
Classes | |
class | CTranslationInterface |
Macros | |
#define | DBG(x) |
#define | LogPrintf(...) LogPrint(NULL, __VA_ARGS__) |
#define | MAKE_ERROR_AND_LOG_FUNC(n) |
Functions | |
std::string | _ (const char *psz) |
void | SetupEnvironment () |
bool | SetupNetworking () |
bool | LogAcceptCategory (const char *category) |
int | LogPrintStr (const std::string &str) |
static int | LogPrint (const char *category, const char *format) |
static bool | error (const char *format) |
void | PrintExceptionContinue (const std::exception *pex, const char *pszThread) |
void | ParseParameters (int argc, const char *const argv[]) |
void | FileCommit (FILE *fileout) |
bool | TruncateFile (FILE *file, unsigned int length) |
int | RaiseFileDescriptorLimit (int nMinFD) |
void | AllocateFileRange (FILE *file, unsigned int offset, unsigned int length) |
bool | RenameOver (boost::filesystem::path src, boost::filesystem::path dest) |
bool | TryCreateDirectory (const boost::filesystem::path &p) |
boost::filesystem::path | GetDefaultDataDir () |
const boost::filesystem::path & | GetDataDir (bool fNetSpecific=true) |
const boost::filesystem::path & | GetBackupsDir () |
void | ClearDatadirCache () |
boost::filesystem::path | GetConfigFile () |
boost::filesystem::path | GetMasternodeConfigFile () |
boost::filesystem::path | GetPidFile () |
void | CreatePidFile (const boost::filesystem::path &path, pid_t pid) |
void | ReadConfigFile (std::map< std::string, std::string > &mapSettingsRet, std::map< std::string, std::vector< std::string > > &mapMultiSettingsRet) |
boost::filesystem::path | GetTempPath () |
void | OpenDebugLog () |
void | ShrinkDebugFile () |
void | runCommand (const std::string &strCommand) |
bool | IsSwitchChar (char c) |
std::string | GetArg (const std::string &strArg, const std::string &strDefault) |
int64_t | GetArg (const std::string &strArg, int64_t nDefault) |
bool | GetBoolArg (const std::string &strArg, bool fDefault) |
bool | SoftSetArg (const std::string &strArg, const std::string &strValue) |
bool | SoftSetBoolArg (const std::string &strArg, bool fValue) |
std::string | HelpMessageGroup (const std::string &message) |
std::string | HelpMessageOpt (const std::string &option, const std::string &message) |
int | GetNumCores () |
void | SetThreadPriority (int nPriority) |
void | RenameThread (const char *name) |
std::string | GetThreadName () |
template<typename Callable > | |
void | TraceThread (const char *name, Callable func) |
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... | |
Variables | |
bool | fMasterNode |
bool | fLiteMode |
int | nWalletBackups |
static const bool | DEFAULT_LOGTIMEMICROS = false |
static const bool | DEFAULT_LOGIPS = false |
static const bool | DEFAULT_LOGTIMESTAMPS = true |
static const bool | DEFAULT_LOGTHREADNAMES = false |
std::map< std::string, std::string > | mapArgs |
std::map< std::string, std::vector< std::string > > | mapMultiArgs |
bool | fDebug |
bool | fPrintToConsole |
bool | fPrintToDebugLog |
bool | fServer |
std::string | strMiscWarning |
bool | fLogTimestamps |
bool | fLogTimeMicros |
bool | fLogThreadNames |
bool | fLogIPs |
volatile bool | fReopenDebugLog |
CTranslationInterface | translationInterface |
const char *const | BITCOIN_CONF_FILENAME |
const char *const | BITCOIN_PID_FILENAME |
#define DBG | ( | x | ) |
Server/client environment: argument handling, config file parsing, logging, thread wrappers
Definition at line 41 of file util.h.
Referenced by CGovernanceManager::AddGovernanceObject(), CGovernanceTriggerManager::AddNewTrigger(), CGovernanceTriggerManager::CleanAndRemove(), CSuperblockManager::CreateSuperblock(), CSuperblock::CSuperblock(), CHDChain::Debug(), CWallet::EncryptWallet(), CGovernanceTriggerManager::GetActiveTriggers(), CSuperblockManager::GetBestSuperblock(), CGovernanceObject::GetHash(), gobject(), CGovernanceObject::IsCollateralValid(), CSuperblockManager::IsSuperblockTriggered(), CGovernanceObject::LoadData(), ParsePaymentAmount(), CSuperblock::ParsePaymentSchedule(), and CMasternodePayments::RequestLowDataPaymentBlocks().
#define LogPrintf | ( | ... | ) | LogPrint(NULL, __VA_ARGS__) |
Definition at line 98 of file util.h.
Referenced by CConnman::AcceptConnection(), TorController::add_onion_cb(), CGovernanceManager::AddGovernanceObject(), CKeyHolderStorage::AddKey(), AddLocal(), CGovernanceTriggerManager::AddNewTrigger(), CPrivateSendServer::AddScriptSig(), CWallet::AddToWallet(), CWallet::AddToWalletIfInvolvingMe(), CPrivateSendServer::AddUserToExistingSession(), AdvertiseLocal(), AppInit2(), CNode::AskFor(), CMasternodeMan::AskForMN(), TorController::auth_cb(), TorController::authchallenge_cb(), AutoBackupWallet(), BackupWallet(), CConnman::BindListenPort(), BitcoinMiner(), CalculateNextWorkRequired(), CDBWrapper::CDBWrapper(), CGovernancePayment::CGovernancePayment(), CWallet::ChangeWalletPassphrase(), CPrivateSendServer::ChargeFees(), CPrivateSendServer::ChargeRandomFees(), CMasternode::Check(), CAddrMan::Check(), CInstantSend::CheckAndRemove(), CMasternodeMan::CheckAndRemove(), CMasternodePayments::CheckAndRemove(), CMasternodePing::CheckAndUpdate(), CPrivateSendClient::CheckAutomaticBackup(), CheckBlock(), CheckForkWarningConditions(), CMasternodeMan::CheckMnbAndUpdateMasternodeList(), CGovernanceObject::CheckOrphanVotes(), CMasternodeBroadcast::CheckOutpoint(), CPrivateSendClient::CheckPoolStateUpdate(), CGovernanceManager::CheckPostponedObjects(), CMasternodeMan::CheckSameAddr(), CMasternodePing::CheckSignature(), CSporkMessage::CheckSignature(), CTxLockVote::CheckSignature(), CDarksendQueue::CheckSignature(), CGovernanceObject::CheckSignature(), CDarksendBroadcastTx::CheckSignature(), CMasternodeBroadcast::CheckSignature(), CleanupBlockRevFiles(), CPrivateSendServer::CommitFinalTransaction(), CWallet::CommitTransaction(), CPrivateSendClient::CompletedTransaction(), TorControlConnection::Connect(), TorController::connected_cb(), CConnman::ConnectNode(), ConnectSocketDirectly(), CWallet::ConvertList(), CGovernanceVoting::ConvertVoteSignal(), CMasternodeBroadcast::Create(), CPrivateSendClient::CreateDenominated(), CInstantSend::CreateEmptyTxLockCandidate(), CreateNewBlock(), CPrivateSendServer::CreateNewSession(), CSuperblockManager::CreateSuperblock(), CInstantSend::CreateTxLockCandidate(), DecryptAES256(), DeleteAuthCookie(), DisconnectBlocks(), Discover(), CPrivateSendClient::DoAutomaticDenominating(), CMasternodeMan::DsegUpdate(), CFlatDB< T >::Dump(), EncryptAES256(), CWallet::EncryptWallet(), CDBEnv::EnvShutdown(), CSporkManager::ExecuteSpork(), CDBWrapper::Exists(), CMasternodePayments::FillBlockPayee(), FindBlockPos(), CMasternodeMan::FindRandomNotInVec(), FindUndoPos(), CWalletDB::FindWalletTx(), GenerateAuthCookie(), CWallet::GenerateNewHDChain(), CWalletTx::GetAmounts(), GetBackupsDir(), CWallet::GetBudgetSystemCollateralTX(), CCoinsViewErrorCatcher::GetCoins(), CMasternodeMan::GetMasternodeByRank(), CWallet::GetMasternodeOutpointAndKeys(), CMasternodeMan::GetMasternodeRank(), CMasternodeMan::GetMasternodeRanks(), CMasternodeMan::GetNextMasternodeInQueueForPayment(), CWallet::GetOutpointAndKeysFromOutput(), GetRandBytes(), GetTempPath(), gobject(), HandleError(), HTTPBindAddresses(), HTTPReq_JSONRPC(), importelectrumwallet(), importwallet(), InitBlockIndex(), InitHTTPServer(), InitLogging(), InitMessage(), CGovernanceManager::InitOnLoad(), InitParameterInteraction(), InitRPCAuthentication(), InterruptTorControl(), InvalidChainFound(), IsBlockPayeeValid(), IsBlockValueValid(), CGovernanceObject::IsCollateralValid(), CPrivateSend::IsCollateralValid(), CPrivateSendServer::IsOutputsCompatibleWithSessionDenom(), CSuperblockManager::IsSuperblockTriggered(), CMasternodeBlockPayees::IsTransactionValid(), CMessageHeader::IsValid(), CGovernanceVote::IsValid(), CMasternodePaymentVote::IsValid(), CTxLockVote::IsValid(), CSuperblock::IsValid(), CPrivateSendClient::JoinExistingQueue(), CKeyHolderStorage::KeepAll(), CWallet::KeepKey(), libevent_log_cb(), CFlatDB< T >::Load(), LoadBlockIndexDB(), CWallet::LoadCScript(), CGovernanceObject::LoadData(), LoadExternalBlockFile(), CWalletDB::LoadWallet(), LogAcceptCategory(), CPrivateSendClient::MakeCollateralAmounts(), CActiveMasternode::ManageState(), CActiveMasternode::ManageStateInitial(), CActiveMasternode::ManageStateLocal(), CActiveMasternode::ManageStateRemote(), CGovernanceManager::MasternodeRateCheck(), Misbehaving(), CWallet::NewKeyPool(), noui_InitMessage(), noui_ThreadSafeMessageBox(), CDBEnv::Open(), OpenDiskFile(), CSuperblock::ParsePaymentSchedule(), CPrivateSendClient::PrepareDenominate(), PrepareShutdown(), PrintExceptionContinue(), CTxMemPool::PrioritiseTransaction(), OverviewPage::privateSendStatus(), CMasternodePayments::ProcessBlock(), ProcessBlockFound(), ProcessGetData(), CPrivateSendServer::ProcessMessage(), CMasternodeSync::ProcessMessage(), CPrivateSendClient::ProcessMessage(), CMasternodeMan::ProcessMessage(), CMasternodePayments::ProcessMessage(), CGovernanceManager::ProcessMessage(), ProcessMessage(), ProcessMessages(), ProcessNewBlock(), CSporkManager::ProcessSpork(), CMasternodeSync::ProcessTick(), CInstantSend::ProcessTxLockRequest(), CInstantSend::ProcessTxLockVote(), CMasternodeMan::ProcessVerifyBroadcast(), CMasternodeMan::ProcessVerifyReply(), CGovernanceObject::ProcessVote(), CGovernanceManager::ProcessVote(), TorController::protocolinfo_cb(), RandAddSeedPerfmon(), CFlatDB< T >::Read(), CDBWrapper::Read(), TorControlConnection::readcb(), CTxMemPool::ReadFeeEstimates(), TorController::Reconnect(), CWalletDB::Recover(), CPrivateSendServer::RelayStatus(), CWalletTx::RelayWalletTransaction(), RemoveLocal(), ReprocessBlocks(), CMasternodePayments::RequestLowDataPaymentBlocks(), CWallet::ResendWalletTransactions(), CWallet::ReserveKeyFromKeyPool(), CInstantSend::ResolveConflicts(), CKeyHolderStorage::ReturnAll(), CWallet::ReturnKey(), CDB::Rewrite(), runCommand(), CDBEnv::Salvage(), CWallet::ScanForWalletTransactions(), CPrivateSendClient::SendDenominate(), CActiveMasternode::SendMasternodePing(), SendMessages(), CMasternodeMan::SendVerifyReply(), CMasternodeMan::SendVerifyRequest(), CConnman::SetMaxOutboundTarget(), CMerkleTx::SetMerkleBranch(), CSporkManager::SetPrivKey(), CPrivateSendServer::SetState(), CPrivateSendClient::SetState(), Shutdown(), CDarkSendRelay::Sign(), CMasternodePing::Sign(), CSporkMessage::Sign(), CGovernanceVote::Sign(), CMasternodePaymentVote::Sign(), CTxLockVote::Sign(), CDarksendQueue::Sign(), CGovernanceObject::Sign(), CDarksendBroadcastTx::Sign(), CMasternodeBroadcast::Sign(), CPrivateSendClient::SignFinalTransaction(), CMasternodePing::SimpleCheck(), CMasternodeBroadcast::SimpleCheck(), CConnman::SocketSendData(), Socks5(), CConnman::Start(), StartHTTPServer(), CPrivateSendClient::StartNewQueue(), StartTorControl(), CConnman::Stop(), StopHTTPServer(), CPrivateSendClient::SubmitDenominate(), CMasternodeSync::SwitchToNextAsset(), CMasternodePayments::Sync(), CGovernanceManager::Sync(), CConnman::ThreadDNSAddressSeed(), ThreadImport(), CConnman::ThreadOpenConnections(), ThreadSendAlert(), CConnman::ThreadSocketHandler(), CWallet::TopUpKeyPool(), TorController::TorController(), TraceThread(), UnlinkPrunedFiles(), CCryptoKeyStore::Unlock(), CWallet::Unlock(), CMasternodeBroadcast::Update(), CGovernanceManager::UpdateCachesAndClean(), CMasternode::UpdateFromNewBroadcast(), CMasternodeMan::UpdateMasternodeList(), UpdateTip(), CWallet::Verify(), CVerifyDB::VerifyDB(), CDarkSendRelay::VerifyMessage(), CInstantSend::Vote(), CFlatDB< T >::Write(), CTxMemPool::WriteFeeEstimates(), and HTTPRequest::~HTTPRequest().
#define MAKE_ERROR_AND_LOG_FUNC | ( | n | ) |
When we switch to C++11, this can be switched to variadic templates instead of this macro-based construction (see tinyformat.h).
|
inline |
Translation function: Call Translate signal on UI interface, which returns a boost::optional result. If no translation slot is registered, nothing is returned, and simply return the input.
Definition at line 84 of file util.h.
Referenced by AddTimeData(), AppendParamsHelpMessages(), AppInit(), AppInit2(), AppInitRawTx(), AppInitRPC(), AutoBackupWallet(), CConnman::BindListenPort(), CallRPC(), CPrivateSendClient::CheckAutomaticBackup(), CheckDiskSpace(), CPrivateSendClient::CheckPoolStateUpdate(), CPrivateSendClient::CheckTimeout(), compress_big(), compress_small(), CPrivateSendClient::CreateDenominated(), CWallet::CreateTransaction(), CVerifyDB::CVerifyDB(), CPrivateSendClient::DoAutomaticDenominating(), GetBackupsDir(), CCoinsViewErrorCatcher::GetCoins(), CPrivateSend::GetMessageByID(), CPrivateSendClient::GetStatus(), CMasternodeSync::GetSyncStatus(), GetWarnings(), HelpMessage(), HelpMessageCli(), importelectrumwallet(), importwallet(), InitRPCAuthentication(), CPrivateSendClient::JoinExistingQueue(), LicenseInfo(), CActiveMasternode::ManageStateLocal(), noui_ThreadSafeMessageBox(), CMasternodeConfig::read(), CWallet::ScanForWalletTransactions(), CConnman::Start(), CPrivateSendClient::StartNewQueue(), CWallet::TopUpKeyPool(), UpdateTip(), CWallet::Verify(), and CVerifyDB::VerifyDB().
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 757 of file util.cpp.
Referenced by FindBlockPos(), and FindUndoPos().
void ClearDatadirCache | ( | ) |
Definition at line 605 of file util.cpp.
Referenced by ReadConfigFile().
void CreatePidFile | ( | const boost::filesystem::path & | path, |
pid_t | pid | ||
) |
Definition at line 664 of file util.cpp.
Referenced by AppInit2().
|
inlinestatic |
Definition at line 131 of file util.h.
Referenced by AcceptBlock(), AcceptBlockHeader(), AcceptToMemoryPoolWorker(), CBasicKeyStore::AddCScript(), ApplyTxInUndo(), AutoBackupWallet(), CheckBlock(), CheckBlockHeader(), CheckIndexAgainstCheckpoint(), CheckProofOfWork(), CheckSequenceLocks(), CAlert::CheckSignature(), CMasternodePaymentVote::CheckSignature(), CommandLineRPC(), ConnectBlock(), ConnectSocketDirectly(), ConnectTip(), ContextualCheckBlock(), ContextualCheckBlockHeader(), DisconnectBlock(), DisconnectTip(), GetAddressIndex(), GetAddressUnspent(), PaymentRequestPlus::getMerchant(), CNode::GetSendVersion(), CCoinsViewDB::GetStats(), GetTimestampIndex(), GetTransaction(), InitBlockIndex(), JSONRPCError(), JSONRPCReply(), JSONRPCReplyObj(), CBlockTreeDB::LoadBlockIndexGuts(), CDBEnv::Open(), CScriptCheck::operator()(), ProcessBlockFound(), ProcessMessage(), ProcessNewBlock(), CFlatDB< T >::Read(), CAddrDB::Read(), CBanDB::Read(), CBlockTreeDB::ReadAddressIndex(), CBlockTreeDB::ReadAddressUnspentIndex(), ReadBlockFromDisk(), CTxMemPool::ReadFeeEstimates(), RegisterLoad(), CNode::SetSendVersion(), Socks5(), TestBlockValidity(), CVerifyDB::VerifyDB(), CFlatDB< T >::Write(), CAddrDB::Write(), CBanDB::Write(), and WriteBlockToDisk().
void FileCommit | ( | FILE * | fileout | ) |
Definition at line 705 of file util.cpp.
Referenced by FlushBlockFile(), CAddrDB::Write(), and CBanDB::Write().
std::string GetArg | ( | const std::string & | strArg, |
const std::string & | strDefault | ||
) |
Return string argument or default value
strArg | Argument to get (e.g. "-foo") |
default | (e.g. "1") |
Definition at line 441 of file util.cpp.
Referenced by AcceptToMemoryPoolWorker(), ActivateBestChainStep(), CWallet::AddToWallet(), AppInit2(), TorController::auth_cb(), CConnman::Ban(), BitcoinApplication::BitcoinApplication(), BitcoinGUI::BitcoinGUI(), BlockNotifyCallback(), CallRPC(), CreateNewBlock(), CBlockPolicyEstimator::estimateSmartFee(), CBlockPolicyEstimator::estimateSmartPriority(), CDB::Flush(), CWallet::GenerateNewHDChain(), GetAuthCookieFile(), GetConfigFile(), GetLangTerritory(), GetListenPort(), GetMasternodeConfigFile(), getmininginfo(), GetPidFile(), HTTPBindAddresses(), OptionsModel::Init(), CKeePassIntegrator::init(), InitHTTPServer(), InitParameterInteraction(), Intro::Intro(), InvalidateBlock(), PaymentServer::LoadRootCAs(), mempoolInfoToJSON(), Misbehaving(), CAlert::Notify(), Intro::pickDataDirectory(), ProcessMessage(), TorController::protocolinfo_cb(), RPCConsole::RPCConsole(), setgenerate(), CAlert::Sign(), StartHTTPServer(), CWallet::TopUpKeyPool(), TorControlThread(), CWallet::Unlock(), CInstantSend::UpdateLockedTransaction(), and verifychain().
int64_t GetArg | ( | const std::string & | strArg, |
int64_t | nDefault | ||
) |
const boost::filesystem::path& GetBackupsDir | ( | ) |
Definition at line 580 of file util.cpp.
Referenced by AutoBackupWallet(), and GUIUtil::showBackups().
bool GetBoolArg | ( | const std::string & | strArg, |
bool | fDefault | ||
) |
Return boolean argument or default value
strArg | Argument to get (e.g. "-foo") |
default | (true or false) |
Definition at line 455 of file util.cpp.
Referenced by AcceptToMemoryPoolWorker(), AppInit(), AppInit2(), AppInitRawTx(), AppInitRPC(), AppInitServers(), BitcoinGUI::BitcoinGUI(), ChainNameFromCommandLine(), CWallet::ChangeWalletPassphrase(), CommandLineRPC(), CreateNewBlock(), CWallet::EncryptWallet(), getgenerate(), PaymentRequestPlus::getMerchant(), GetWarnings(), HelpMessage(), HelpMessageDialog::HelpMessageDialog(), CKeePassIntegrator::init(), InitBlockIndex(), InitHTTPServer(), BitcoinApplication::initializeResult(), InitLogging(), InitParameterInteraction(), main(), OnRPCPreCommand(), CDBEnv::Open(), OutputTx(), Intro::pickDataDirectory(), ProcessMessage(), SplashScreen::SplashScreen(), CConnman::Start(), CConnman::ThreadDNSAddressSeed(), ThreadFlushWalletDB(), ThreadImport(), CWallet::Unlock(), and CWallet::Verify().
boost::filesystem::path GetConfigFile | ( | ) |
Definition at line 611 of file util.cpp.
Referenced by AppInit2(), CallRPC(), GUIUtil::openConfigfile(), and ReadConfigFile().
const boost::filesystem::path& GetDataDir | ( | bool | fNetSpecific = true | ) |
Definition at line 547 of file util.cpp.
Referenced by AppInit(), AppInit2(), AppInitRPC(), AutoBackupWallet(), BackupWallet(), CAddrDB::CAddrDB(), CBanDB::CBanDB(), CDB::CDB(), CFlatDB< T >::CFlatDB(), CheckDiskSpace(), CleanupBlockRevFiles(), ClientModel::dataDir(), GetAuthCookieFile(), GetBackupsDir(), GetBlockPosFilename(), GetConfigFile(), GetMasternodeConfigFile(), GetPidFile(), TorController::GetPrivateKeyFile(), ipcServerName(), LogPrintStr(), main(), OpenDebugLog(), GUIUtil::openDebugLogfile(), PrepareShutdown(), RPCConsole::RPCConsole(), ShrinkDebugFile(), ThreadImport(), CWallet::Verify(), CAddrDB::Write(), and CBanDB::Write().
boost::filesystem::path GetDefaultDataDir | ( | ) |
Definition at line 516 of file util.cpp.
Referenced by AppInit2(), GetDataDir(), and Intro::getDefaultDataDirectory().
boost::filesystem::path GetMasternodeConfigFile | ( | ) |
Definition at line 620 of file util.cpp.
Referenced by AppInit2(), GUIUtil::openMNConfigfile(), and CMasternodeConfig::read().
int GetNumCores | ( | ) |
Return the number of physical cores available on the current system.
Definition at line 948 of file util.cpp.
Referenced by AppInit2(), GenerateBitcoins(), HelpMessage(), and OptionsDialog::OptionsDialog().
boost::filesystem::path GetPidFile | ( | ) |
Definition at line 657 of file util.cpp.
Referenced by AppInit2(), and PrepareShutdown().
std::string GetThreadName | ( | ) |
Definition at line 889 of file util.cpp.
Referenced by LogAcceptCategory(), and LogThreadNameStr().
std::string HelpMessageGroup | ( | const std::string & | message | ) |
Format a string to be used as group of options in help messages
message | Group name (e.g. "RPC server options:") |
Definition at line 482 of file util.cpp.
Referenced by AppendParamsHelpMessages(), AppInitRawTx(), HelpMessage(), HelpMessageCli(), and HelpMessageDialog::HelpMessageDialog().
std::string HelpMessageOpt | ( | const std::string & | option, |
const std::string & | message | ||
) |
Format a string to be used as option description in help messages
option | Option message (e.g. "-rpcuser=<user>") |
message | Option description (e.g. "Username for JSON-RPC connections") |
Definition at line 486 of file util.cpp.
Referenced by AppendParamsHelpMessages(), AppInitRawTx(), HelpMessage(), HelpMessageCli(), and HelpMessageDialog::HelpMessageDialog().
std::string IntVersionToString | ( | uint32_t | nVersion | ) |
Converts version as 4-byte unsigned integer to string.
nVersion | 4-byte unsigned integer, most significant byte is always 0 |
Definition at line 978 of file util.cpp.
Referenced by SafeIntVersionToString().
|
inline |
Definition at line 164 of file util.h.
Referenced by AppInit(), CommandLineRawTx(), and CommandLineRPC().
bool LogAcceptCategory | ( | const char * | category | ) |
Return true if log accepts specified category
Definition at line 247 of file util.cpp.
Referenced by InitHTTPServer(), LogPrint(), and CWallet::SelectCoinsGrouppedByAddresses().
|
inlinestatic |
Zero-arg versions of logging and error, these are not covered by TINYFORMAT_FOREACH_ARGNUM
Definition at line 126 of file util.h.
Referenced by CConnman::AcceptConnection(), CMasternodeSync::AcceptedBlockHeader(), AcceptToMemoryPool(), AcceptToMemoryPoolWorker(), CMasternodeMan::Add(), CAddrMan::Add(), TorController::add_onion_cb(), CPrivateSendServer::AddEntry(), CGovernanceManager::AddGovernanceObject(), AddOrphanTx(), CPrivateSendServer::AddScriptSig(), AddTimeData(), CNode::AskFor(), TorController::auth_cb(), TorController::authchallenge_cb(), CCoinsViewDB::BatchWrite(), CMasternodeSync::BumpAssetLastTime(), CMasternodeMan::Check(), CMasternode::Check(), CTxMemPool::check(), CInstantSend::CheckAndRemove(), CMasternodeMan::CheckAndRemove(), CMasternodePayments::CheckAndRemove(), CMasternodePing::CheckAndUpdate(), CPrivateSendClient::CheckAutomaticBackup(), CPrivateSend::CheckDSTXes(), CPrivateSendServer::CheckForCompleteQueue(), CMasternodeMan::CheckMnbAndUpdateMasternodeList(), CMasternodeBroadcast::CheckOutpoint(), CPrivateSendServer::CheckPool(), CPrivateSendClient::CheckPool(), CMasternodePayments::CheckPreviousBlockVotes(), CMasternodeBroadcast::CheckSignature(), CPrivateSendServer::CheckTimeout(), CPrivateSendClient::CheckTimeout(), CGovernanceTriggerManager::CleanAndRemove(), CGovernanceManager::Clear(), CNode::CloseSocketDisconnect(), CNode::CNode(), CPrivateSendServer::CommitFinalTransaction(), CGovernanceManager::ConfirmInventoryRequest(), ConnectBlock(), CConnman::ConnectNode(), ConnectSocketDirectly(), ConnectTip(), CMasternodeBroadcast::Create(), CPrivateSendClient::CreateDenominated(), CPrivateSendServer::CreateFinalTransaction(), CPrivateSendServer::CreateNewSession(), CSuperblockManager::CreateSuperblock(), CInstantSend::CreateTxLockCandidate(), CSuperblock::CSuperblock(), DebugMessageHandler(), TorController::disconnected_cb(), DisconnectTip(), CPrivateSendClient::DoAutomaticDenominating(), CMasternodeMan::DoFullVerificationStep(), CKeePassIntegrator::doHTTPPost(), CMasternodeMan::DsegUpdate(), CConnman::DumpAddresses(), CConnman::DumpBanlist(), EraseOrphansFor(), TxConfirmStats::EstimateMedianVal(), TorControlConnection::eventcb(), CSporkManager::ExecuteSpork(), FillBlockPayments(), FindFilesToPrune(), CMasternodeMan::FindRandomNotInVec(), CDBEnv::Flush(), CMasternodeBlockPayees::GetBestPayee(), CSuperblock::GetPaymentsLimit(), CWallet::GetRealOutpointPrivateSendRounds(), CSuperblockManager::GetRequiredPaymentsString(), CSporkManager::GetSporkIDByName(), CSporkManager::GetSporkNameByID(), CSporkManager::GetSporkValue(), CAddrMan::Good_(), CMasternodeBlockPayees::HasPayeeWithVotes(), http_reject_request_cb(), http_request_cb(), HTTPBindAddresses(), InitHTTPAllowList(), InitHTTPServer(), CZMQNotificationInterface::Initialize(), CZMQAbstractPublishNotifier::Initialize(), InterruptHTTPRPC(), InterruptHTTPServer(), InterruptRPC(), CPrivateSendServer::IsAcceptableDenomAndCollateral(), IsBlockPayeeValid(), IsBlockValueValid(), CPrivateSend::IsCollateralValid(), CPrivateSendServer::IsInputScriptSigValid(), CSporkManager::IsSporkActive(), CSuperblockManager::IsSuperblockTriggered(), CMasternodeBlockPayees::IsTransactionValid(), CGovernanceVote::IsValid(), CTxLockRequest::IsValid(), CMasternodePaymentVote::IsValid(), CTxLockVote::IsValid(), CSuperblock::IsValid(), CPrivateSendClient::JoinExistingQueue(), libevent_log_cb(), LimitMempoolSize(), LoadExternalBlockFile(), CInstantSend::LockTransactionInputs(), CPrivateSendClient::MakeCollateralAmounts(), CDBEnv::MakeMock(), CActiveMasternode::ManageState(), CActiveMasternode::ManageStateInitial(), CActiveMasternode::ManageStateLocal(), CActiveMasternode::ManageStateRemote(), CPrivateSendClient::NewBlock(), TxConfirmStats::NewTx(), CZMQPublishHashBlockNotifier::NotifyBlock(), CZMQPublishRawBlockNotifier::NotifyBlock(), CMasternodeSync::NotifyHeaderTip(), CZMQPublishHashTransactionNotifier::NotifyTransaction(), CZMQPublishRawTransactionNotifier::NotifyTransaction(), CZMQPublishHashTransactionLockNotifier::NotifyTransactionLock(), CZMQPublishRawTransactionLockNotifier::NotifyTransactionLock(), OnRPCStopped(), JSONRequest::parse(), CAlert::ProcessAlert(), CMasternodePayments::ProcessBlock(), CBlockPolicyEstimator::processBlock(), CBlockPolicyEstimator::processBlockTx(), ProcessGetData(), CPrivateSendServer::ProcessMessage(), CPrivateSendClient::ProcessMessage(), CMasternodeMan::ProcessMessage(), CMasternodePayments::ProcessMessage(), CGovernanceManager::ProcessMessage(), ProcessMessage(), CSporkManager::ProcessSpork(), CMasternodeSync::ProcessTick(), CBlockPolicyEstimator::processTransaction(), CInstantSend::ProcessTxLockRequest(), CInstantSend::ProcessTxLockVote(), CMasternodeMan::ProcessVerifyBroadcast(), CMasternodeMan::ProcessVerifyReply(), CGovernanceObject::ProcessVote(), CGovernanceManager::ProcessVote(), TorController::protocolinfo_cb(), CNode::PushInventory(), CConnman::PushMessage(), RandAddSeedPerfmon(), TxConfirmStats::Read(), TorControlConnection::readcb(), CNode::ReceiveMsgBytes(), RegisterHTTPHandler(), CPrivateSendServer::RelayCompletedTransaction(), CPrivateSendServer::RelayFinalTransaction(), TxConfirmStats::removeTx(), CBlockPolicyEstimator::removeTx(), CGovernanceManager::RequestGovernanceObject(), CGovernanceManager::RequestGovernanceObjectVotes(), CGovernanceManager::RequestOrphanObjects(), CInstantSend::ResolveConflicts(), CKeePassIntegrator::rpcAssociate(), CKeePassIntegrator::rpcGetLogins(), RPCRunLater(), CKeePassIntegrator::rpcSetLogin(), CKeePassIntegrator::rpcTestAssociation(), CWallet::SelectCoinsGrouppedByAddresses(), CWallet::SelectCoinsMinConf(), CPrivateSendClient::SendDenominate(), CActiveMasternode::SendMasternodePing(), SendMessages(), CMasternodeMan::SendVerifyRequest(), CGovernanceObject::SerializationOp(), CConnman::SetNetworkActive(), CPrivateSendServer::SetState(), CZMQNotificationInterface::Shutdown(), CZMQAbstractPublishNotifier::Shutdown(), CGovernanceObject::Sign(), CPrivateSendClient::SignFinalTransaction(), CMasternodePing::SimpleCheck(), Socks5(), CConnman::Start(), StartHTTPRPC(), StartHTTPServer(), StartRPC(), StopHTTPRPC(), StopHTTPServer(), StopRPC(), CPrivateSendClient::SubmitDenominate(), CConnman::SweepBanned(), CGovernanceManager::Sync(), CInstantSend::SyncTransaction(), CPrivateSend::SyncTransaction(), ThreadFlushWalletDB(), ThreadHTTP(), CConnman::ThreadMnbRequestConnections(), CConnman::ThreadOpenConnections(), CConnman::ThreadSocketHandler(), OverviewPage::togglePrivateSend(), TorController::TorController(), CTxMemPool::TrimToSize(), CInstantSend::TryToFinalizeLockCandidate(), UnregisterHTTPHandler(), CAddrMan::Unserialize(), CGovernanceManager::UpdateCachesAndClean(), CGovernanceManager::UpdateCurrentWatchdog(), CMasternodeSync::UpdatedBlockTip(), CPrivateSendClient::UpdatedBlockTip(), CMasternodePayments::UpdatedBlockTip(), CMasternodeMan::UpdatedBlockTip(), CGovernanceManager::UpdatedBlockTip(), CMasternode::UpdateLastPaid(), CInstantSend::UpdateLockedTransaction(), CInstantSend::Vote(), and zmqError().
int LogPrintStr | ( | const std::string & | str | ) |
Send a string to the log output
Definition at line 342 of file util.cpp.
Referenced by error(), and LogPrint().
void OpenDebugLog | ( | ) |
Definition at line 226 of file util.cpp.
Referenced by AppInit2().
void ParseParameters | ( | int | argc, |
const char *const | argv[] | ||
) |
Definition at line 406 of file util.cpp.
Referenced by AppInit(), AppInitRawTx(), AppInitRPC(), and main().
void PrintExceptionContinue | ( | const std::exception * | pex, |
const char * | pszThread | ||
) |
Definition at line 509 of file util.cpp.
Referenced by AppInit(), CommandLineRawTx(), CommandLineRPC(), BitcoinCore::handleRunawayException(), main(), ProcessMessages(), and TraceThread().
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 734 of file util.cpp.
Referenced by AppInit2().
void ReadConfigFile | ( | std::map< std::string, std::string > & | mapSettingsRet, |
std::map< std::string, std::vector< std::string > > & | mapMultiSettingsRet | ||
) |
bool RenameOver | ( | boost::filesystem::path | src, |
boost::filesystem::path | dest | ||
) |
Definition at line 675 of file util.cpp.
Referenced by ThreadImport(), CAddrDB::Write(), and CBanDB::Write().
void RenameThread | ( | const char * | name | ) |
Definition at line 873 of file util.cpp.
Referenced by BitcoinMiner(), HTTPWorkQueueRun(), PrepareShutdown(), ThreadCheckPrivateSend(), ThreadCheckPrivateSendClient(), ThreadCheckPrivateSendServer(), ThreadFlushWalletDB(), ThreadHTTP(), ThreadImport(), ThreadScriptCheck(), and TraceThread().
void runCommand | ( | const std::string & | strCommand | ) |
Definition at line 866 of file util.cpp.
Referenced by CWallet::AddToWallet(), BlockNotifyCallback(), CAlert::Notify(), and CInstantSend::UpdateLockedTransaction().
std::string SafeIntVersionToString | ( | uint32_t | nVersion | ) |
Copy of the IntVersionToString, that returns "Invalid version" string instead of throwing std::bad_cast.
nVersion | 4-byte unsigned integer, most significant byte is always 0 |
Definition at line 994 of file util.cpp.
Referenced by masternodelist().
void SetThreadPriority | ( | int | nPriority | ) |
Definition at line 935 of file util.cpp.
Referenced by BitcoinMiner(), SetThreadPriority(), and CConnman::ThreadMessageHandler().
bool SetupNetworking | ( | ) |
Definition at line 923 of file util.cpp.
Referenced by AppInit2(), and main().
void ShrinkDebugFile | ( | ) |
Definition at line 799 of file util.cpp.
Referenced by AppInit2().
bool SoftSetArg | ( | const std::string & | strArg, |
const std::string & | strValue | ||
) |
Set an argument if it doesn't already have a value
strArg | Argument to set (e.g. "-foo") |
strValue | Value (e.g. "1") |
Definition at line 462 of file util.cpp.
Referenced by OptionsModel::Init(), InitParameterInteraction(), Intro::pickDataDirectory(), and SoftSetBoolArg().
bool SoftSetBoolArg | ( | const std::string & | strArg, |
bool | fValue | ||
) |
Set a boolean argument if it doesn't already have a value
strArg | Argument to set (e.g. "-foo") |
fValue | Value (e.g. false) |
Definition at line 470 of file util.cpp.
Referenced by AppInit(), OptionsModel::Init(), InitParameterInteraction(), and CWalletDB::LoadWallet().
uint32_t StringVersionToInt | ( | const std::string & | strVersion | ) |
Converts version strings to 4-byte unsigned integer.
strVersion | version in "x.x.x" format (decimal digits only) |
Definition at line 958 of file util.cpp.
Referenced by sentinelping().
void TraceThread | ( | const char * | name, |
Callable | func | ||
) |
.. and a wrapper that just calls func once
Definition at line 249 of file util.h.
Referenced by CConnman::Start(), and StartTorControl().
bool TruncateFile | ( | FILE * | file, |
unsigned int | length | ||
) |
Definition at line 722 of file util.cpp.
Referenced by FlushBlockFile().
bool TryCreateDirectory | ( | const boost::filesystem::path & | p | ) |
Ignores exceptions thrown by Boost's create_directory 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 691 of file util.cpp.
Referenced by CDBWrapper::CDBWrapper(), CDBEnv::Open(), and Intro::pickDataDirectory().
const char* const BITCOIN_CONF_FILENAME |
Definition at line 119 of file util.cpp.
Referenced by GetConfigFile(), getgenerate(), HelpMessage(), and HelpMessageCli().
const char* const BITCOIN_PID_FILENAME |
Definition at line 120 of file util.cpp.
Referenced by GetPidFile(), and HelpMessage().
|
static |
Definition at line 51 of file util.h.
Referenced by HelpMessage(), and InitLogging().
|
static |
Definition at line 53 of file util.h.
Referenced by HelpMessage(), and InitLogging().
|
static |
Definition at line 50 of file util.h.
Referenced by HelpMessage(), and InitLogging().
|
static |
Definition at line 52 of file util.h.
Referenced by HelpMessage(), and InitLogging().
bool fDebug |
Definition at line 124 of file util.cpp.
Referenced by AppInit2(), debug(), IsBlockPayeeValid(), IsBlockValueValid(), LogAcceptCategory(), ProcessMessage(), CConnman::SetNetworkActive(), TransactionDesc::toHTML(), and CoinControlDialog::updateView().
bool fLiteMode |
Definition at line 109 of file util.cpp.
Referenced by AppInit2(), CGovernanceManager::DoMaintenance(), CWallet::GetAnonymizableBalance(), CWallet::GetAnonymizedBalance(), CWallet::GetAverageAnonymizedRounds(), CWallet::GetDenominatedBalance(), getinfo(), CWallet::GetNeedsToBeAnonymizedBalance(), CWallet::GetNormalizedAnonymizedBalance(), OverviewPage::OverviewPage(), CMasternodePayments::ProcessBlock(), CPrivateSendServer::ProcessMessage(), CInstantSend::ProcessMessage(), CPrivateSendClient::ProcessMessage(), CMasternodeMan::ProcessMessage(), CMasternodePayments::ProcessMessage(), CGovernanceManager::ProcessMessage(), CSporkManager::ProcessSpork(), SendCoinsDialog::SendCoinsDialog(), ThreadCheckPrivateSend(), ThreadCheckPrivateSendClient(), ThreadCheckPrivateSendServer(), OverviewPage::updateAdvancedPSUI(), CPrivateSendClient::UpdatedBlockTip(), CMasternodeMan::UpdateLastPaid(), and OverviewPage::~OverviewPage().
bool fLogIPs |
Definition at line 133 of file util.cpp.
Referenced by CNode::CNode(), InitLogging(), and ProcessMessage().
bool fLogThreadNames |
Definition at line 132 of file util.cpp.
Referenced by InitLogging(), and LogThreadNameStr().
bool fLogTimeMicros |
Definition at line 131 of file util.cpp.
Referenced by InitLogging(), and LogTimestampStr().
bool fLogTimestamps |
Definition at line 130 of file util.cpp.
Referenced by AppInit2(), InitLogging(), and LogTimestampStr().
bool fMasterNode |
Definition at line 108 of file util.cpp.
Referenced by CConnman::AcceptConnection(), CPrivateSendServer::AddEntry(), CPrivateSendServer::AddUserToExistingSession(), AppInit2(), CWallet::AvailableCoins(), CPrivateSendServer::ChargeFees(), CPrivateSendServer::ChargeRandomFees(), CMasternode::Check(), CPrivateSendServer::CheckForCompleteQueue(), CMasternodeMan::CheckMnbAndUpdateMasternodeList(), CMasternodeBroadcast::CheckOutpoint(), CPrivateSendServer::CheckPool(), CPrivateSendClient::CheckPoolStateUpdate(), CPrivateSendServer::CheckTimeout(), CPrivateSendClient::CheckTimeout(), CPrivateSendServer::CommitFinalTransaction(), CPrivateSendClient::CompletedTransaction(), CPrivateSendServer::CreateNewSession(), CPrivateSendClient::DoAutomaticDenominating(), getpoolinfo(), CPrivateSendServer::IsAcceptableDenomAndCollateral(), CMasternodePaymentVote::IsValid(), CActiveMasternode::ManageState(), masternode(), OverviewPage::OverviewPage(), privatesend(), CMasternodePayments::ProcessBlock(), CPrivateSendServer::ProcessMessage(), CPrivateSendClient::ProcessMessage(), CMasternodeSync::ProcessTick(), CGovernanceManager::RequestGovernanceObjectVotes(), CWallet::SelectCoinsDark(), CWallet::SelectCoinsGrouppedByAddresses(), CPrivateSendClient::SendDenominate(), CMasternodeMan::SendVerifyReply(), CPrivateSendServer::SetState(), CDarksendQueue::Sign(), CDarksendBroadcastTx::Sign(), CPrivateSendClient::SignFinalTransaction(), CGovernanceManager::Sync(), ThreadCheckPrivateSend(), CMasternodeBroadcast::Update(), CMasternodeMan::UpdatedBlockTip(), CMasternode::UpdateFromNewBroadcast(), CMasternodeMan::UpdateLastPaid(), CInstantSend::Vote(), and OverviewPage::~OverviewPage().
bool fPrintToConsole |
Definition at line 125 of file util.cpp.
Referenced by InitLogging(), and LogPrintStr().
bool fPrintToDebugLog |
Definition at line 126 of file util.cpp.
Referenced by AppInit2(), InitLogging(), LogPrintStr(), and main().
volatile bool fReopenDebugLog |
Definition at line 134 of file util.cpp.
Referenced by HandleSIGHUP(), and LogPrintStr().
bool fServer |
Definition at line 128 of file util.cpp.
Referenced by AppInit2().
std::map<std::string, std::string> mapArgs |
Definition at line 122 of file util.cpp.
Referenced by OptionsModel::addOverriddenOption(), AppInit(), AppInit2(), AppInitRawTx(), AppInitRPC(), CallRPC(), debug(), CWallet::GenerateNewHDChain(), GetArg(), GetBackupsDir(), GetBoolArg(), GetDataDir(), HTTPBindAddresses(), InitParameterInteraction(), InitRPCAuthentication(), main(), ParseParameters(), ProcessMessage(), setgenerate(), SoftSetArg(), CConnman::ThreadMnbRequestConnections(), CConnman::ThreadOpenConnections(), ThreadSendAlert(), and CDSNotificationInterface::UpdatedBlockTip().
std::map<std::string, std::vector<std::string> > mapMultiArgs |
Definition at line 123 of file util.cpp.
Referenced by AppInit(), AppInit2(), AppInitRPC(), debug(), HTTPBindAddresses(), InitHTTPAllowList(), InitParameterInteraction(), LogAcceptCategory(), main(), multiUserAuthorized(), ParseParameters(), CConnman::ThreadMnbRequestConnections(), CConnman::ThreadOpenAddedConnections(), and CConnman::ThreadOpenConnections().
int nWalletBackups |
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 117 of file util.cpp.
Referenced by AppInit2(), AutoBackupWallet(), CPrivateSendClient::CheckAutomaticBackup(), OverviewPage::DisablePrivateSendCompletely(), HelpMessage(), CWallet::KeepKey(), OverviewPage::OverviewPage(), OverviewPage::privateSendStatus(), and CWallet::Unlock().
std::string strMiscWarning |
Definition at line 129 of file util.cpp.
Referenced by AddTimeData(), GetBackupsDir(), GetWarnings(), BitcoinCore::handleRunawayException(), main(), and UpdateTip().
CTranslationInterface translationInterface |