@ -199,7 +199,7 @@ void Shutdown()
@@ -199,7 +199,7 @@ void Shutdown()
StopTorControl ( ) ;
UnregisterNodeSignals ( GetNodeSignals ( ) ) ;
if ( fDumpMempoolLater & & GetArg ( " -persistmempool " , DEFAULT_PERSIST_MEMPOOL ) ) {
if ( fDumpMempoolLater & & gArgs . GetArg ( " -persistmempool " , DEFAULT_PERSIST_MEMPOOL ) ) {
DumpMempool ( ) ;
}
@ -321,7 +321,7 @@ void OnRPCPreCommand(const CRPCCommand& cmd)
@@ -321,7 +321,7 @@ void OnRPCPreCommand(const CRPCCommand& cmd)
{
// Observe safe mode
std : : string strWarning = GetWarnings ( " rpc " ) ;
if ( strWarning ! = " " & & ! GetBoolArg ( " -disablesafemode " , DEFAULT_DISABLE_SAFEMODE ) & &
if ( strWarning ! = " " & & ! gArgs . GetBoolArg ( " -disablesafemode " , DEFAULT_DISABLE_SAFEMODE ) & &
! cmd . okSafeMode )
throw JSONRPCError ( RPC_FORBIDDEN_BY_SAFE_MODE , std : : string ( " Safe mode: " ) + strWarning ) ;
}
@ -332,7 +332,7 @@ std::string HelpMessage(HelpMessageMode mode)
@@ -332,7 +332,7 @@ std::string HelpMessage(HelpMessageMode mode)
const auto testnetBaseParams = CreateBaseChainParams ( CBaseChainParams : : TESTNET ) ;
const auto defaultChainParams = CreateChainParams ( CBaseChainParams : : MAIN ) ;
const auto testnetChainParams = CreateChainParams ( CBaseChainParams : : TESTNET ) ;
const bool showDebug = GetBoolArg ( " -help-debug " , false ) ;
const bool showDebug = gArgs . GetBoolArg ( " -help-debug " , false ) ;
// When adding new options to the categories, please keep and ensure alphabetical ordering.
// Do not translate _(...) -help-debug options, Many technical terms, and only a very small audience, so is unnecessary stress to translators.
@ -546,7 +546,7 @@ static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex
@@ -546,7 +546,7 @@ static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex
if ( initialSync | | ! pBlockIndex )
return ;
std : : string strCmd = GetArg ( " -blocknotify " , " " ) ;
std : : string strCmd = gArgs . GetArg ( " -blocknotify " , " " ) ;
boost : : replace_all ( strCmd , " %s " , pBlockIndex - > GetBlockHash ( ) . GetHex ( ) ) ;
boost : : thread t ( runCommand , strCmd ) ; // thread runs free
@ -683,12 +683,12 @@ void ThreadImport(std::vector<fs::path> vImportFiles)
@@ -683,12 +683,12 @@ void ThreadImport(std::vector<fs::path> vImportFiles)
StartShutdown ( ) ;
}
if ( GetBoolArg ( " -stopafterblockimport " , DEFAULT_STOPAFTERBLOCKIMPORT ) ) {
if ( gArgs . GetBoolArg ( " -stopafterblockimport " , DEFAULT_STOPAFTERBLOCKIMPORT ) ) {
LogPrintf ( " Stopping after block import \n " ) ;
StartShutdown ( ) ;
}
} // End scope of CImportingNow
if ( GetArg ( " -persistmempool " , DEFAULT_PERSIST_MEMPOOL ) ) {
if ( gArgs . GetArg ( " -persistmempool " , DEFAULT_PERSIST_MEMPOOL ) ) {
LoadMempool ( ) ;
fDumpMempoolLater = ! fRequestShutdown ;
}
@ -727,7 +727,7 @@ bool AppInitServers(boost::thread_group& threadGroup)
@@ -727,7 +727,7 @@ bool AppInitServers(boost::thread_group& threadGroup)
return false ;
if ( ! StartHTTPRPC ( ) )
return false ;
if ( GetBoolArg ( " -rest " , DEFAULT_REST_ENABLE ) & & ! StartREST ( ) )
if ( gArgs . GetBoolArg ( " -rest " , DEFAULT_REST_ENABLE ) & & ! StartREST ( ) )
return false ;
if ( ! StartHTTPServer ( ) )
return false ;
@ -739,61 +739,61 @@ void InitParameterInteraction()
@@ -739,61 +739,61 @@ void InitParameterInteraction()
{
// when specifying an explicit binding address, you want to listen on it
// even when -connect or -proxy is specified
if ( IsArgSet ( " -bind " ) ) {
if ( SoftSetBoolArg ( " -listen " , true ) )
if ( gArgs . IsArgSet ( " -bind " ) ) {
if ( gArgs . SoftSetBoolArg ( " -listen " , true ) )
LogPrintf ( " %s: parameter interaction: -bind set -> setting -listen=1 \n " , __func__ ) ;
}
if ( IsArgSet ( " -whitebind " ) ) {
if ( SoftSetBoolArg ( " -listen " , true ) )
if ( gArgs . IsArgSet ( " -whitebind " ) ) {
if ( gArgs . SoftSetBoolArg ( " -listen " , true ) )
LogPrintf ( " %s: parameter interaction: -whitebind set -> setting -listen=1 \n " , __func__ ) ;
}
if ( gArgs . IsArgSet ( " -connect " ) ) {
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
if ( SoftSetBoolArg ( " -dnsseed " , false ) )
if ( gArgs . SoftSetBoolArg ( " -dnsseed " , false ) )
LogPrintf ( " %s: parameter interaction: -connect set -> setting -dnsseed=0 \n " , __func__ ) ;
if ( SoftSetBoolArg ( " -listen " , false ) )
if ( gArgs . SoftSetBoolArg ( " -listen " , false ) )
LogPrintf ( " %s: parameter interaction: -connect set -> setting -listen=0 \n " , __func__ ) ;
}
if ( IsArgSet ( " -proxy " ) ) {
if ( gArgs . IsArgSet ( " -proxy " ) ) {
// to protect privacy, do not listen by default if a default proxy server is specified
if ( SoftSetBoolArg ( " -listen " , false ) )
if ( gArgs . SoftSetBoolArg ( " -listen " , false ) )
LogPrintf ( " %s: parameter interaction: -proxy set -> setting -listen=0 \n " , __func__ ) ;
// to protect privacy, do not use UPNP when a proxy is set. The user may still specify -listen=1
// to listen locally, so don't rely on this happening through -listen below.
if ( SoftSetBoolArg ( " -upnp " , false ) )
if ( gArgs . SoftSetBoolArg ( " -upnp " , false ) )
LogPrintf ( " %s: parameter interaction: -proxy set -> setting -upnp=0 \n " , __func__ ) ;
// to protect privacy, do not discover addresses by default
if ( SoftSetBoolArg ( " -discover " , false ) )
if ( gArgs . SoftSetBoolArg ( " -discover " , false ) )
LogPrintf ( " %s: parameter interaction: -proxy set -> setting -discover=0 \n " , __func__ ) ;
}
if ( ! GetBoolArg ( " -listen " , DEFAULT_LISTEN ) ) {
if ( ! gArgs . GetBoolArg ( " -listen " , DEFAULT_LISTEN ) ) {
// do not map ports or try to retrieve public IP when not listening (pointless)
if ( SoftSetBoolArg ( " -upnp " , false ) )
if ( gArgs . SoftSetBoolArg ( " -upnp " , false ) )
LogPrintf ( " %s: parameter interaction: -listen=0 -> setting -upnp=0 \n " , __func__ ) ;
if ( SoftSetBoolArg ( " -discover " , false ) )
if ( gArgs . SoftSetBoolArg ( " -discover " , false ) )
LogPrintf ( " %s: parameter interaction: -listen=0 -> setting -discover=0 \n " , __func__ ) ;
if ( SoftSetBoolArg ( " -listenonion " , false ) )
if ( gArgs . SoftSetBoolArg ( " -listenonion " , false ) )
LogPrintf ( " %s: parameter interaction: -listen=0 -> setting -listenonion=0 \n " , __func__ ) ;
}
if ( IsArgSet ( " -externalip " ) ) {
if ( gArgs . IsArgSet ( " -externalip " ) ) {
// if an explicit public IP is specified, do not try to find others
if ( SoftSetBoolArg ( " -discover " , false ) )
if ( gArgs . SoftSetBoolArg ( " -discover " , false ) )
LogPrintf ( " %s: parameter interaction: -externalip set -> setting -discover=0 \n " , __func__ ) ;
}
// disable whitelistrelay in blocksonly mode
if ( GetBoolArg ( " -blocksonly " , DEFAULT_BLOCKSONLY ) ) {
if ( SoftSetBoolArg ( " -whitelistrelay " , false ) )
if ( gArgs . GetBoolArg ( " -blocksonly " , DEFAULT_BLOCKSONLY ) ) {
if ( gArgs . SoftSetBoolArg ( " -whitelistrelay " , false ) )
LogPrintf ( " %s: parameter interaction: -blocksonly=1 -> setting -whitelistrelay=0 \n " , __func__ ) ;
}
// Forcing relay from whitelisted hosts implies we will accept relays from them in the first place.
if ( GetBoolArg ( " -whitelistforcerelay " , DEFAULT_WHITELISTFORCERELAY ) ) {
if ( SoftSetBoolArg ( " -whitelistrelay " , true ) )
if ( gArgs . GetBoolArg ( " -whitelistforcerelay " , DEFAULT_WHITELISTFORCERELAY ) ) {
if ( gArgs . SoftSetBoolArg ( " -whitelistrelay " , true ) )
LogPrintf ( " %s: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1 \n " , __func__ ) ;
}
}
@ -805,10 +805,10 @@ static std::string ResolveErrMsg(const char * const optname, const std::string&
@@ -805,10 +805,10 @@ static std::string ResolveErrMsg(const char * const optname, const std::string&
void InitLogging ( )
{
fPrintToConsole = GetBoolArg ( " -printtoconsole " , false ) ;
fLogTimestamps = GetBoolArg ( " -logtimestamps " , DEFAULT_LOGTIMESTAMPS ) ;
fLogTimeMicros = GetBoolArg ( " -logtimemicros " , DEFAULT_LOGTIMEMICROS ) ;
fLogIPs = GetBoolArg ( " -logips " , DEFAULT_LOGIPS ) ;
fPrintToConsole = gArgs . GetBoolArg ( " -printtoconsole " , false ) ;
fLogTimestamps = gArgs . GetBoolArg ( " -logtimestamps " , DEFAULT_LOGTIMESTAMPS ) ;
fLogTimeMicros = gArgs . GetBoolArg ( " -logtimemicros " , DEFAULT_LOGTIMEMICROS ) ;
fLogIPs = gArgs . GetBoolArg ( " -logips " , DEFAULT_LOGIPS ) ;
LogPrintf ( " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n " ) ;
LogPrintf ( " Bitcoin version %s \n " , FormatFullVersion ( ) ) ;
@ -865,7 +865,7 @@ bool AppInitBasicSetup()
@@ -865,7 +865,7 @@ bool AppInitBasicSetup()
return InitError ( " Initializing networking failed " ) ;
# ifndef WIN32
if ( ! GetBoolArg ( " -sysperms " , false ) ) {
if ( ! gArgs . GetBoolArg ( " -sysperms " , false ) ) {
umask ( 077 ) ;
}
@ -893,8 +893,8 @@ bool AppInitParameterInteraction()
@@ -893,8 +893,8 @@ bool AppInitParameterInteraction()
// also see: InitParameterInteraction()
// if using block pruning, then disallow txindex
if ( GetArg ( " -prune " , 0 ) ) {
if ( GetBoolArg ( " -txindex " , DEFAULT_TXINDEX ) )
if ( gArgs . GetArg ( " -prune " , 0 ) ) {
if ( gArgs . GetBoolArg ( " -txindex " , DEFAULT_TXINDEX ) )
return InitError ( _ ( " Prune mode is incompatible with -txindex. " ) ) ;
}
@ -906,7 +906,7 @@ bool AppInitParameterInteraction()
@@ -906,7 +906,7 @@ bool AppInitParameterInteraction()
// Make sure enough file descriptors are available
int nBind = std : : max ( nUserBind , size_t ( 1 ) ) ;
nUserMaxConnections = GetArg ( " -maxconnections " , DEFAULT_MAX_PEER_CONNECTIONS ) ;
nUserMaxConnections = gArgs . GetArg ( " -maxconnections " , DEFAULT_MAX_PEER_CONNECTIONS ) ;
nMaxConnections = std : : max ( nUserMaxConnections , 0 ) ;
// Trim requested connection counts, to fit into system limitations
@ -947,55 +947,55 @@ bool AppInitParameterInteraction()
@@ -947,55 +947,55 @@ bool AppInitParameterInteraction()
}
// Check for -debugnet
if ( GetBoolArg ( " -debugnet " , false ) )
if ( gArgs . GetBoolArg ( " -debugnet " , false ) )
InitWarning ( _ ( " Unsupported argument -debugnet ignored, use -debug=net. " ) ) ;
// Check for -socks - as this is a privacy risk to continue, exit here
if ( IsArgSet ( " -socks " ) )
if ( gArgs . IsArgSet ( " -socks " ) )
return InitError ( _ ( " Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported. " ) ) ;
// Check for -tor - as this is a privacy risk to continue, exit here
if ( GetBoolArg ( " -tor " , false ) )
if ( gArgs . GetBoolArg ( " -tor " , false ) )
return InitError ( _ ( " Unsupported argument -tor found, use -onion. " ) ) ;
if ( GetBoolArg ( " -benchmark " , false ) )
if ( gArgs . GetBoolArg ( " -benchmark " , false ) )
InitWarning ( _ ( " Unsupported argument -benchmark ignored, use -debug=bench. " ) ) ;
if ( GetBoolArg ( " -whitelistalwaysrelay " , false ) )
if ( gArgs . GetBoolArg ( " -whitelistalwaysrelay " , false ) )
InitWarning ( _ ( " Unsupported argument -whitelistalwaysrelay ignored, use -whitelistrelay and/or -whitelistforcerelay. " ) ) ;
if ( IsArgSet ( " -blockminsize " ) )
if ( gArgs . IsArgSet ( " -blockminsize " ) )
InitWarning ( " Unsupported argument -blockminsize ignored. " ) ;
// Checkmempool and checkblockindex default to true in regtest mode
int ratio = std : : min < int > ( std : : max < int > ( GetArg ( " -checkmempool " , chainparams . DefaultConsistencyChecks ( ) ? 1 : 0 ) , 0 ) , 1000000 ) ;
int ratio = std : : min < int > ( std : : max < int > ( gArgs . GetArg ( " -checkmempool " , chainparams . DefaultConsistencyChecks ( ) ? 1 : 0 ) , 0 ) , 1000000 ) ;
if ( ratio ! = 0 ) {
mempool . setSanityCheck ( 1.0 / ratio ) ;
}
fCheckBlockIndex = GetBoolArg ( " -checkblockindex " , chainparams . DefaultConsistencyChecks ( ) ) ;
fCheckpointsEnabled = GetBoolArg ( " -checkpoints " , DEFAULT_CHECKPOINTS_ENABLED ) ;
fCheckBlockIndex = gArgs . GetBoolArg ( " -checkblockindex " , chainparams . DefaultConsistencyChecks ( ) ) ;
fCheckpointsEnabled = gArgs . GetBoolArg ( " -checkpoints " , DEFAULT_CHECKPOINTS_ENABLED ) ;
hashAssumeValid = uint256S ( GetArg ( " -assumevalid " , chainparams . GetConsensus ( ) . defaultAssumeValid . GetHex ( ) ) ) ;
hashAssumeValid = uint256S ( gArgs . GetArg ( " -assumevalid " , chainparams . GetConsensus ( ) . defaultAssumeValid . GetHex ( ) ) ) ;
if ( ! hashAssumeValid . IsNull ( ) )
LogPrintf ( " Assuming ancestors of block %s have valid signatures. \n " , hashAssumeValid . GetHex ( ) ) ;
else
LogPrintf ( " Validating signatures for all blocks. \n " ) ;
// mempool limits
int64_t nMempoolSizeMax = GetArg ( " -maxmempool " , DEFAULT_MAX_MEMPOOL_SIZE ) * 1000000 ;
int64_t nMempoolSizeMin = GetArg ( " -limitdescendantsize " , DEFAULT_DESCENDANT_SIZE_LIMIT ) * 1000 * 40 ;
int64_t nMempoolSizeMax = gArgs . GetArg ( " -maxmempool " , DEFAULT_MAX_MEMPOOL_SIZE ) * 1000000 ;
int64_t nMempoolSizeMin = gArgs . GetArg ( " -limitdescendantsize " , DEFAULT_DESCENDANT_SIZE_LIMIT ) * 1000 * 40 ;
if ( nMempoolSizeMax < 0 | | nMempoolSizeMax < nMempoolSizeMin )
return InitError ( strprintf ( _ ( " -maxmempool must be at least %d MB " ) , std : : ceil ( nMempoolSizeMin / 1000000.0 ) ) ) ;
// incremental relay fee sets the minimum feerate increase necessary for BIP 125 replacement in the mempool
// and the amount the mempool min fee increases above the feerate of txs evicted due to mempool limiting.
if ( IsArgSet ( " -incrementalrelayfee " ) )
if ( gArgs . IsArgSet ( " -incrementalrelayfee " ) )
{
CAmount n = 0 ;
if ( ! ParseMoney ( GetArg ( " -incrementalrelayfee " , " " ) , n ) )
return InitError ( AmountErrMsg ( " incrementalrelayfee " , GetArg ( " -incrementalrelayfee " , " " ) ) ) ;
if ( ! ParseMoney ( gArgs . GetArg ( " -incrementalrelayfee " , " " ) , n ) )
return InitError ( AmountErrMsg ( " incrementalrelayfee " , gArgs . GetArg ( " -incrementalrelayfee " , " " ) ) ) ;
incrementalRelayFee = CFeeRate ( n ) ;
}
// -par=0 means autodetect, but nScriptCheckThreads==0 means no concurrency
nScriptCheckThreads = GetArg ( " -par " , DEFAULT_SCRIPTCHECK_THREADS ) ;
nScriptCheckThreads = gArgs . GetArg ( " -par " , DEFAULT_SCRIPTCHECK_THREADS ) ;
if ( nScriptCheckThreads < = 0 )
nScriptCheckThreads + = GetNumCores ( ) ;
if ( nScriptCheckThreads < = 1 )
@ -1004,7 +1004,7 @@ bool AppInitParameterInteraction()
@@ -1004,7 +1004,7 @@ bool AppInitParameterInteraction()
nScriptCheckThreads = MAX_SCRIPTCHECK_THREADS ;
// block pruning; get the amount of disk space (in MiB) to allot for block & undo files
int64_t nPruneArg = GetArg ( " -prune " , 0 ) ;
int64_t nPruneArg = gArgs . GetArg ( " -prune " , 0 ) ;
if ( nPruneArg < 0 ) {
return InitError ( _ ( " Prune cannot be configured with a negative value. " ) ) ;
}
@ -1026,14 +1026,14 @@ bool AppInitParameterInteraction()
@@ -1026,14 +1026,14 @@ bool AppInitParameterInteraction()
RegisterWalletRPCCommands ( tableRPC ) ;
# endif
nConnectTimeout = GetArg ( " -timeout " , DEFAULT_CONNECT_TIMEOUT ) ;
nConnectTimeout = gArgs . GetArg ( " -timeout " , DEFAULT_CONNECT_TIMEOUT ) ;
if ( nConnectTimeout < = 0 )
nConnectTimeout = DEFAULT_CONNECT_TIMEOUT ;
if ( IsArgSet ( " -minrelaytxfee " ) ) {
if ( gArgs . IsArgSet ( " -minrelaytxfee " ) ) {
CAmount n = 0 ;
if ( ! ParseMoney ( GetArg ( " -minrelaytxfee " , " " ) , n ) ) {
return InitError ( AmountErrMsg ( " minrelaytxfee " , GetArg ( " -minrelaytxfee " , " " ) ) ) ;
if ( ! ParseMoney ( gArgs . GetArg ( " -minrelaytxfee " , " " ) , n ) ) {
return InitError ( AmountErrMsg ( " minrelaytxfee " , gArgs . GetArg ( " -minrelaytxfee " , " " ) ) ) ;
}
// High fee check is done afterward in CWallet::ParameterInteraction()
: : minRelayTxFee = CFeeRate ( n ) ;
@ -1045,55 +1045,55 @@ bool AppInitParameterInteraction()
@@ -1045,55 +1045,55 @@ bool AppInitParameterInteraction()
// Sanity check argument for min fee for including tx in block
// TODO: Harmonize which arguments need sanity checking and where that happens
if ( IsArgSet ( " -blockmintxfee " ) )
if ( gArgs . IsArgSet ( " -blockmintxfee " ) )
{
CAmount n = 0 ;
if ( ! ParseMoney ( GetArg ( " -blockmintxfee " , " " ) , n ) )
return InitError ( AmountErrMsg ( " blockmintxfee " , GetArg ( " -blockmintxfee " , " " ) ) ) ;
if ( ! ParseMoney ( gArgs . GetArg ( " -blockmintxfee " , " " ) , n ) )
return InitError ( AmountErrMsg ( " blockmintxfee " , gArgs . GetArg ( " -blockmintxfee " , " " ) ) ) ;
}
// Feerate used to define dust. Shouldn't be changed lightly as old
// implementations may inadvertently create non-standard transactions
if ( IsArgSet ( " -dustrelayfee " ) )
if ( gArgs . IsArgSet ( " -dustrelayfee " ) )
{
CAmount n = 0 ;
if ( ! ParseMoney ( GetArg ( " -dustrelayfee " , " " ) , n ) | | 0 = = n )
return InitError ( AmountErrMsg ( " dustrelayfee " , GetArg ( " -dustrelayfee " , " " ) ) ) ;
if ( ! ParseMoney ( gArgs . GetArg ( " -dustrelayfee " , " " ) , n ) | | 0 = = n )
return InitError ( AmountErrMsg ( " dustrelayfee " , gArgs . GetArg ( " -dustrelayfee " , " " ) ) ) ;
dustRelayFee = CFeeRate ( n ) ;
}
fRequireStandard = ! GetBoolArg ( " -acceptnonstdtxn " , ! chainparams . RequireStandard ( ) ) ;
fRequireStandard = ! gArgs . GetBoolArg ( " -acceptnonstdtxn " , ! chainparams . RequireStandard ( ) ) ;
if ( chainparams . RequireStandard ( ) & & ! fRequireStandard )
return InitError ( strprintf ( " acceptnonstdtxn is not currently supported for %s chain " , chainparams . NetworkIDString ( ) ) ) ;
nBytesPerSigOp = GetArg ( " -bytespersigop " , nBytesPerSigOp ) ;
nBytesPerSigOp = gArgs . GetArg ( " -bytespersigop " , nBytesPerSigOp ) ;
# ifdef ENABLE_WALLET
if ( ! CWallet : : ParameterInteraction ( ) )
return false ;
# endif
fIsBareMultisigStd = GetBoolArg ( " -permitbaremultisig " , DEFAULT_PERMIT_BAREMULTISIG ) ;
fAcceptDatacarrier = GetBoolArg ( " -datacarrier " , DEFAULT_ACCEPT_DATACARRIER ) ;
nMaxDatacarrierBytes = GetArg ( " -datacarriersize " , nMaxDatacarrierBytes ) ;
fIsBareMultisigStd = gArgs . GetBoolArg ( " -permitbaremultisig " , DEFAULT_PERMIT_BAREMULTISIG ) ;
fAcceptDatacarrier = gArgs . GetBoolArg ( " -datacarrier " , DEFAULT_ACCEPT_DATACARRIER ) ;
nMaxDatacarrierBytes = gArgs . GetArg ( " -datacarriersize " , nMaxDatacarrierBytes ) ;
// Option to startup with mocktime set (used for regression testing):
SetMockTime ( GetArg ( " -mocktime " , 0 ) ) ; // SetMockTime(0) is a no-op
SetMockTime ( gArgs . GetArg ( " -mocktime " , 0 ) ) ; // SetMockTime(0) is a no-op
if ( GetBoolArg ( " -peerbloomfilters " , DEFAULT_PEERBLOOMFILTERS ) )
if ( gArgs . GetBoolArg ( " -peerbloomfilters " , DEFAULT_PEERBLOOMFILTERS ) )
nLocalServices = ServiceFlags ( nLocalServices | NODE_BLOOM ) ;
if ( GetArg ( " -rpcserialversion " , DEFAULT_RPC_SERIALIZE_VERSION ) < 0 )
if ( gArgs . GetArg ( " -rpcserialversion " , DEFAULT_RPC_SERIALIZE_VERSION ) < 0 )
return InitError ( " rpcserialversion must be non-negative. " ) ;
if ( GetArg ( " -rpcserialversion " , DEFAULT_RPC_SERIALIZE_VERSION ) > 1 )
if ( gArgs . GetArg ( " -rpcserialversion " , DEFAULT_RPC_SERIALIZE_VERSION ) > 1 )
return InitError ( " unknown rpcserialversion requested. " ) ;
nMaxTipAge = GetArg ( " -maxtipage " , DEFAULT_MAX_TIP_AGE ) ;
nMaxTipAge = gArgs . GetArg ( " -maxtipage " , DEFAULT_MAX_TIP_AGE ) ;
fEnableReplacement = GetBoolArg ( " -mempoolreplacement " , DEFAULT_ENABLE_REPLACEMENT ) ;
if ( ( ! fEnableReplacement ) & & IsArgSet ( " -mempoolreplacement " ) ) {
fEnableReplacement = gArgs . GetBoolArg ( " -mempoolreplacement " , DEFAULT_ENABLE_REPLACEMENT ) ;
if ( ( ! fEnableReplacement ) & & gArgs . IsArgSet ( " -mempoolreplacement " ) ) {
// Minimal effort at forwards compatibility
std : : string strReplacementModeList = GetArg ( " -mempoolreplacement " , " " ) ; // default is impossible
std : : string strReplacementModeList = gArgs . GetArg ( " -mempoolreplacement " , " " ) ; // default is impossible
std : : vector < std : : string > vstrReplacementModes ;
boost : : split ( vstrReplacementModes , strReplacementModeList , boost : : is_any_of ( " , " ) ) ;
fEnableReplacement = ( std : : find ( vstrReplacementModes . begin ( ) , vstrReplacementModes . end ( ) , " fee " ) ! = vstrReplacementModes . end ( ) ) ;
@ -1198,7 +1198,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1198,7 +1198,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
# ifndef WIN32
CreatePidFile ( GetPidFile ( ) , getpid ( ) ) ;
# endif
if ( GetBoolArg ( " -shrinkdebugfile " , logCategories = = BCLog : : NONE ) ) {
if ( gArgs . GetBoolArg ( " -shrinkdebugfile " , logCategories = = BCLog : : NONE ) ) {
// Do this first since it both loads a bunch of debug.log into memory,
// and because this needs to happen before any other debug.log printing
ShrinkDebugFile ( ) ;
@ -1211,7 +1211,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1211,7 +1211,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf ( " Startup time: %s \n " , DateTimeStrFormat ( " %Y-%m-%d %H:%M:%S " , GetTime ( ) ) ) ;
LogPrintf ( " Default data directory %s \n " , GetDefaultDataDir ( ) . string ( ) ) ;
LogPrintf ( " Using data directory %s \n " , GetDataDir ( ) . string ( ) ) ;
LogPrintf ( " Using config file %s \n " , GetConfigFile ( GetArg ( " -conf " , BITCOIN_CONF_FILENAME ) ) . string ( ) ) ;
LogPrintf ( " Using config file %s \n " , GetConfigFile ( gArgs . GetArg ( " -conf " , BITCOIN_CONF_FILENAME ) ) . string ( ) ) ;
LogPrintf ( " Using at most %i automatic connections (%i file descriptors available) \n " , nMaxConnections , nFD ) ;
InitSignatureCache ( ) ;
@ -1234,7 +1234,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1234,7 +1234,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
* that the server is there and will be ready later ) . Warmup mode will
* be disabled when initialisation is finished .
*/
if ( GetBoolArg ( " -server " , false ) )
if ( gArgs . GetBoolArg ( " -server " , false ) )
{
uiInterface . InitMessage . connect ( SetRPCWarmupStatus ) ;
if ( ! AppInitServers ( threadGroup ) )
@ -1291,12 +1291,12 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1291,12 +1291,12 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
}
// Check for host lookup allowed before parsing any network related parameters
fNameLookup = GetBoolArg ( " -dns " , DEFAULT_NAME_LOOKUP ) ;
fNameLookup = gArgs . GetBoolArg ( " -dns " , DEFAULT_NAME_LOOKUP ) ;
bool proxyRandomize = GetBoolArg ( " -proxyrandomize " , DEFAULT_PROXYRANDOMIZE ) ;
bool proxyRandomize = gArgs . GetBoolArg ( " -proxyrandomize " , DEFAULT_PROXYRANDOMIZE ) ;
// -proxy sets a proxy for all outgoing network traffic
// -noproxy (or -proxy=0) as well as the empty string can be used to not set a proxy, this is the default
std : : string proxyArg = GetArg ( " -proxy " , " " ) ;
std : : string proxyArg = gArgs . GetArg ( " -proxy " , " " ) ;
SetLimited ( NET_TOR ) ;
if ( proxyArg ! = " " & & proxyArg ! = " 0 " ) {
CService proxyAddr ;
@ -1318,7 +1318,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1318,7 +1318,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
// -onion can be used to set only a proxy for .onion, or override normal proxy for .onion addresses
// -noonion (or -onion=0) disables connecting to .onion entirely
// An empty string is used to not override the onion proxy (in which case it defaults to -proxy set above, or none)
std : : string onionArg = GetArg ( " -onion " , " " ) ;
std : : string onionArg = gArgs . GetArg ( " -onion " , " " ) ;
if ( onionArg ! = " " ) {
if ( onionArg = = " 0 " ) { // Handle -noonion/-onion=0
SetLimited ( NET_TOR ) ; // set onions as unreachable
@ -1336,9 +1336,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1336,9 +1336,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
}
// see Step 2: parameter interactions for more information about these
fListen = GetBoolArg ( " -listen " , DEFAULT_LISTEN ) ;
fDiscover = GetBoolArg ( " -discover " , true ) ;
fRelayTxes = ! GetBoolArg ( " -blocksonly " , DEFAULT_BLOCKSONLY ) ;
fListen = gArgs . GetBoolArg ( " -listen " , DEFAULT_LISTEN ) ;
fDiscover = gArgs . GetBoolArg ( " -discover " , true ) ;
fRelayTxes = ! gArgs . GetBoolArg ( " -blocksonly " , DEFAULT_BLOCKSONLY ) ;
for ( const std : : string & strAddr : gArgs . GetArgs ( " -externalip " ) ) {
CService addrLocal ;
@ -1358,27 +1358,27 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1358,27 +1358,27 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
uint64_t nMaxOutboundLimit = 0 ; //unlimited unless -maxuploadtarget is set
uint64_t nMaxOutboundTimeframe = MAX_UPLOAD_TIMEFRAME ;
if ( IsArgSet ( " -maxuploadtarget " ) ) {
nMaxOutboundLimit = GetArg ( " -maxuploadtarget " , DEFAULT_MAX_UPLOAD_TARGET ) * 1024 * 1024 ;
if ( gArgs . IsArgSet ( " -maxuploadtarget " ) ) {
nMaxOutboundLimit = gArgs . GetArg ( " -maxuploadtarget " , DEFAULT_MAX_UPLOAD_TARGET ) * 1024 * 1024 ;
}
// ********************************************************* Step 7: load block chain
fReindex = GetBoolArg ( " -reindex " , false ) ;
bool fReindexChainState = GetBoolArg ( " -reindex-chainstate " , false ) ;
fReindex = gArgs . GetBoolArg ( " -reindex " , false ) ;
bool fReindexChainState = gArgs . GetBoolArg ( " -reindex-chainstate " , false ) ;
// cache size calculations
int64_t nTotalCache = ( GetArg ( " -dbcache " , nDefaultDbCache ) < < 20 ) ;
int64_t nTotalCache = ( gArgs . GetArg ( " -dbcache " , nDefaultDbCache ) < < 20 ) ;
nTotalCache = std : : max ( nTotalCache , nMinDbCache < < 20 ) ; // total cache cannot be less than nMinDbCache
nTotalCache = std : : min ( nTotalCache , nMaxDbCache < < 20 ) ; // total cache cannot be greater than nMaxDbcache
int64_t nBlockTreeDBCache = nTotalCache / 8 ;
nBlockTreeDBCache = std : : min ( nBlockTreeDBCache , ( GetBoolArg ( " -txindex " , DEFAULT_TXINDEX ) ? nMaxBlockDBAndTxIndexCache : nMaxBlockDBCache ) < < 20 ) ;
nBlockTreeDBCache = std : : min ( nBlockTreeDBCache , ( gArgs . GetBoolArg ( " -txindex " , DEFAULT_TXINDEX ) ? nMaxBlockDBAndTxIndexCache : nMaxBlockDBCache ) < < 20 ) ;
nTotalCache - = nBlockTreeDBCache ;
int64_t nCoinDBCache = std : : min ( nTotalCache / 2 , ( nTotalCache / 4 ) + ( 1 < < 23 ) ) ; // use 25%-50% of the remainder for disk cache
nCoinDBCache = std : : min ( nCoinDBCache , nMaxCoinsDBCache < < 20 ) ; // cap total coins db cache
nTotalCache - = nCoinDBCache ;
nCoinCacheUsage = nTotalCache ; // the rest goes to in-memory cache
int64_t nMempoolSizeMax = GetArg ( " -maxmempool " , DEFAULT_MAX_MEMPOOL_SIZE ) * 1000000 ;
int64_t nMempoolSizeMax = gArgs . GetArg ( " -maxmempool " , DEFAULT_MAX_MEMPOOL_SIZE ) * 1000000 ;
LogPrintf ( " Cache configuration: \n " ) ;
LogPrintf ( " * Using %.1fMiB for block index database \n " , nBlockTreeDBCache * ( 1.0 / 1024 / 1024 ) ) ;
LogPrintf ( " * Using %.1fMiB for chain state database \n " , nCoinDBCache * ( 1.0 / 1024 / 1024 ) ) ;
@ -1427,7 +1427,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1427,7 +1427,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError ( _ ( " Incorrect or no genesis block found. Wrong datadir for network? " ) ) ;
// Check for changed -txindex state
if ( fTxIndex ! = GetBoolArg ( " -txindex " , DEFAULT_TXINDEX ) ) {
if ( fTxIndex ! = gArgs . GetBoolArg ( " -txindex " , DEFAULT_TXINDEX ) ) {
strLoadError = _ ( " You need to rebuild the database using -reindex-chainstate to change -txindex " ) ;
break ;
}
@ -1493,7 +1493,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1493,7 +1493,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
if ( ! is_coinsview_empty ) {
uiInterface . InitMessage ( _ ( " Verifying blocks... " ) ) ;
if ( fHavePruned & & GetArg ( " -checkblocks " , DEFAULT_CHECKBLOCKS ) > MIN_BLOCKS_TO_KEEP ) {
if ( fHavePruned & & gArgs . GetArg ( " -checkblocks " , DEFAULT_CHECKBLOCKS ) > MIN_BLOCKS_TO_KEEP ) {
LogPrintf ( " Prune: pruned datadir may not have more than %d blocks; only checking available blocks " ,
MIN_BLOCKS_TO_KEEP ) ;
}
@ -1510,8 +1510,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1510,8 +1510,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
if ( ! CVerifyDB ( ) . VerifyDB ( chainparams , pcoinsdbview , GetArg ( " -checklevel " , DEFAULT_CHECKLEVEL ) ,
GetArg ( " -checkblocks " , DEFAULT_CHECKBLOCKS ) ) ) {
if ( ! CVerifyDB ( ) . VerifyDB ( chainparams , pcoinsdbview , gArgs . GetArg ( " -checklevel " , DEFAULT_CHECKLEVEL ) ,
gArgs . GetArg ( " -checkblocks " , DEFAULT_CHECKBLOCKS ) ) ) {
strLoadError = _ ( " Corrupted block database detected " ) ;
break ;
}
@ -1610,7 +1610,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1610,7 +1610,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
fHaveGenesis = true ;
}
if ( IsArgSet ( " -blocknotify " ) )
if ( gArgs . IsArgSet ( " -blocknotify " ) )
uiInterface . NotifyBlockTip . connect ( BlockNotifyCallback ) ;
std : : vector < fs : : path > vImportFiles ;
@ -1634,13 +1634,13 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1634,13 +1634,13 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
//// debug print
LogPrintf ( " mapBlockIndex.size() = %u \n " , mapBlockIndex . size ( ) ) ;
LogPrintf ( " nBestHeight = %d \n " , chainActive . Height ( ) ) ;
if ( GetBoolArg ( " -listenonion " , DEFAULT_LISTEN_ONION ) )
if ( gArgs . GetBoolArg ( " -listenonion " , DEFAULT_LISTEN_ONION ) )
StartTorControl ( threadGroup , scheduler ) ;
Discover ( threadGroup ) ;
// Map ports with UPnP
MapPort ( GetBoolArg ( " -upnp " , DEFAULT_UPNP ) ) ;
MapPort ( gArgs . GetBoolArg ( " -upnp " , DEFAULT_UPNP ) ) ;
CConnman : : Options connOptions ;
connOptions . nLocalServices = nLocalServices ;
@ -1651,8 +1651,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
@@ -1651,8 +1651,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
connOptions . nMaxFeeler = 1 ;
connOptions . nBestHeight = chainActive . Height ( ) ;
connOptions . uiInterface = & uiInterface ;
connOptions . nSendBufferMaxSize = 1000 * GetArg ( " -maxsendbuffer " , DEFAULT_MAXSENDBUFFER ) ;
connOptions . nReceiveFloodSize = 1000 * GetArg ( " -maxreceivebuffer " , DEFAULT_MAXRECEIVEBUFFER ) ;
connOptions . nSendBufferMaxSize = 1000 * gArgs . GetArg ( " -maxsendbuffer " , DEFAULT_MAXSENDBUFFER ) ;
connOptions . nReceiveFloodSize = 1000 * gArgs . GetArg ( " -maxreceivebuffer " , DEFAULT_MAXRECEIVEBUFFER ) ;
connOptions . nMaxOutboundTimeframe = nMaxOutboundTimeframe ;
connOptions . nMaxOutboundLimit = nMaxOutboundLimit ;