@@ -843,7 +843,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
843
843
}
844
844
845
845
// if using block pruning, then disallow txindex and coinstatsindex
846
- if (args.GetArg (" -prune" , 0 )) {
846
+ if (args.GetIntArg (" -prune" , 0 )) {
847
847
if (args.GetBoolArg (" -txindex" , DEFAULT_TXINDEX))
848
848
return InitError (_ (" Prune mode is incompatible with -txindex." ));
849
849
if (args.GetBoolArg (" -coinstatsindex" , DEFAULT_COINSTATSINDEX))
@@ -868,7 +868,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
868
868
869
869
// Make sure enough file descriptors are available
870
870
int nBind = std::max (nUserBind, size_t (1 ));
871
- nUserMaxConnections = args.GetArg (" -maxconnections" , DEFAULT_MAX_PEER_CONNECTIONS);
871
+ nUserMaxConnections = args.GetIntArg (" -maxconnections" , DEFAULT_MAX_PEER_CONNECTIONS);
872
872
nMaxConnections = std::max (nUserMaxConnections, 0 );
873
873
874
874
nFD = RaiseFileDescriptorLimit (nMaxConnections + MIN_CORE_FILEDESCRIPTORS + MAX_ADDNODE_CONNECTIONS + nBind + NUM_FDS_MESSAGE_CAPTURE);
@@ -913,8 +913,8 @@ bool AppInitParameterInteraction(const ArgsManager& args)
913
913
}
914
914
915
915
// mempool limits
916
- int64_t nMempoolSizeMax = args.GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 ;
917
- int64_t nMempoolSizeMin = args.GetArg (" -limitdescendantsize" , DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40 ;
916
+ int64_t nMempoolSizeMax = args.GetIntArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 ;
917
+ int64_t nMempoolSizeMin = args.GetIntArg (" -limitdescendantsize" , DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40 ;
918
918
if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin)
919
919
return InitError (strprintf (_ (" -maxmempool must be at least %d MB" ), std::ceil (nMempoolSizeMin / 1000000.0 )));
920
920
// incremental relay fee sets the minimum feerate increase necessary for BIP 125 replacement in the mempool
@@ -928,7 +928,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
928
928
}
929
929
930
930
// block pruning; get the amount of disk space (in MiB) to allot for block & undo files
931
- int64_t nPruneArg = args.GetArg (" -prune" , 0 );
931
+ int64_t nPruneArg = args.GetIntArg (" -prune" , 0 );
932
932
if (nPruneArg < 0 ) {
933
933
return InitError (_ (" Prune cannot be configured with a negative value." ));
934
934
}
@@ -945,12 +945,12 @@ bool AppInitParameterInteraction(const ArgsManager& args)
945
945
fPruneMode = true ;
946
946
}
947
947
948
- nConnectTimeout = args.GetArg (" -timeout" , DEFAULT_CONNECT_TIMEOUT);
948
+ nConnectTimeout = args.GetIntArg (" -timeout" , DEFAULT_CONNECT_TIMEOUT);
949
949
if (nConnectTimeout <= 0 ) {
950
950
nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
951
951
}
952
952
953
- peer_connect_timeout = args.GetArg (" -peertimeout" , DEFAULT_PEER_CONNECT_TIMEOUT);
953
+ peer_connect_timeout = args.GetIntArg (" -peertimeout" , DEFAULT_PEER_CONNECT_TIMEOUT);
954
954
if (peer_connect_timeout <= 0 ) {
955
955
return InitError (Untranslated (" peertimeout cannot be configured with a negative value." ));
956
956
}
@@ -990,27 +990,27 @@ bool AppInitParameterInteraction(const ArgsManager& args)
990
990
if (!chainparams.IsTestChain () && !fRequireStandard ) {
991
991
return InitError (strprintf (Untranslated (" acceptnonstdtxn is not currently supported for %s chain" ), chainparams.NetworkIDString ()));
992
992
}
993
- nBytesPerSigOp = args.GetArg (" -bytespersigop" , nBytesPerSigOp);
993
+ nBytesPerSigOp = args.GetIntArg (" -bytespersigop" , nBytesPerSigOp);
994
994
995
995
if (!g_wallet_init_interface.ParameterInteraction ()) return false ;
996
996
997
997
fIsBareMultisigStd = args.GetBoolArg (" -permitbaremultisig" , DEFAULT_PERMIT_BAREMULTISIG);
998
998
fAcceptDatacarrier = args.GetBoolArg (" -datacarrier" , DEFAULT_ACCEPT_DATACARRIER);
999
- nMaxDatacarrierBytes = args.GetArg (" -datacarriersize" , nMaxDatacarrierBytes);
999
+ nMaxDatacarrierBytes = args.GetIntArg (" -datacarriersize" , nMaxDatacarrierBytes);
1000
1000
1001
1001
// Option to startup with mocktime set (used for regression testing):
1002
- SetMockTime (args.GetArg (" -mocktime" , 0 )); // SetMockTime(0) is a no-op
1002
+ SetMockTime (args.GetIntArg (" -mocktime" , 0 )); // SetMockTime(0) is a no-op
1003
1003
1004
1004
if (args.GetBoolArg (" -peerbloomfilters" , DEFAULT_PEERBLOOMFILTERS))
1005
1005
nLocalServices = ServiceFlags (nLocalServices | NODE_BLOOM);
1006
1006
1007
- if (args.GetArg (" -rpcserialversion" , DEFAULT_RPC_SERIALIZE_VERSION) < 0 )
1007
+ if (args.GetIntArg (" -rpcserialversion" , DEFAULT_RPC_SERIALIZE_VERSION) < 0 )
1008
1008
return InitError (Untranslated (" rpcserialversion must be non-negative." ));
1009
1009
1010
- if (args.GetArg (" -rpcserialversion" , DEFAULT_RPC_SERIALIZE_VERSION) > 1 )
1010
+ if (args.GetIntArg (" -rpcserialversion" , DEFAULT_RPC_SERIALIZE_VERSION) > 1 )
1011
1011
return InitError (Untranslated (" Unknown rpcserialversion requested." ));
1012
1012
1013
- nMaxTipAge = args.GetArg (" -maxtipage" , DEFAULT_MAX_TIP_AGE);
1013
+ nMaxTipAge = args.GetIntArg (" -maxtipage" , DEFAULT_MAX_TIP_AGE);
1014
1014
1015
1015
if (args.IsArgSet (" -proxy" ) && args.GetArg (" -proxy" , " " ).empty ()) {
1016
1016
return InitError (_ (" No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>." ));
@@ -1099,7 +1099,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1099
1099
InitSignatureCache ();
1100
1100
InitScriptExecutionCache ();
1101
1101
1102
- int script_threads = args.GetArg (" -par" , DEFAULT_SCRIPTCHECK_THREADS);
1102
+ int script_threads = args.GetIntArg (" -par" , DEFAULT_SCRIPTCHECK_THREADS);
1103
1103
if (script_threads <= 0 ) {
1104
1104
// -par=0 means autodetect (number of cores - 1 script threads)
1105
1105
// -par=-n means "leave n cores free" (number of cores - n - 1 script threads)
@@ -1206,7 +1206,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1206
1206
}
1207
1207
1208
1208
assert (!node.banman );
1209
- node.banman = std::make_unique<BanMan>(gArgs .GetDataDirNet () / " banlist" , &uiInterface, args.GetArg (" -bantime" , DEFAULT_MISBEHAVING_BANTIME));
1209
+ node.banman = std::make_unique<BanMan>(gArgs .GetDataDirNet () / " banlist" , &uiInterface, args.GetIntArg (" -bantime" , DEFAULT_MISBEHAVING_BANTIME));
1210
1210
assert (!node.connman );
1211
1211
node.connman = std::make_unique<CConnman>(GetRand (std::numeric_limits<uint64_t >::max ()), GetRand (std::numeric_limits<uint64_t >::max ()), *node.addrman , args.GetBoolArg (" -networkactive" , true ));
1212
1212
@@ -1216,7 +1216,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1216
1216
if (!ignores_incoming_txs) node.fee_estimator = std::make_unique<CBlockPolicyEstimator>();
1217
1217
1218
1218
assert (!node.mempool );
1219
- int check_ratio = std::min<int >(std::max<int >(args.GetArg (" -checkmempool" , chainparams.DefaultConsistencyChecks () ? 1 : 0 ), 0 ), 1000000 );
1219
+ int check_ratio = std::min<int >(std::max<int >(args.GetIntArg (" -checkmempool" , chainparams.DefaultConsistencyChecks () ? 1 : 0 ), 0 ), 1000000 );
1220
1220
node.mempool = std::make_unique<CTxMemPool>(node.fee_estimator .get (), check_ratio);
1221
1221
1222
1222
assert (!node.chainman );
@@ -1323,7 +1323,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1323
1323
bool fReindexChainState = args.GetBoolArg (" -reindex-chainstate" , false );
1324
1324
1325
1325
// cache size calculations
1326
- int64_t nTotalCache = (args.GetArg (" -dbcache" , nDefaultDbCache) << 20 );
1326
+ int64_t nTotalCache = (args.GetIntArg (" -dbcache" , nDefaultDbCache) << 20 );
1327
1327
nTotalCache = std::max (nTotalCache, nMinDbCache << 20 ); // total cache cannot be less than nMinDbCache
1328
1328
nTotalCache = std::min (nTotalCache, nMaxDbCache << 20 ); // total cache cannot be greater than nMaxDbcache
1329
1329
int64_t nBlockTreeDBCache = std::min (nTotalCache / 8 , nMaxBlockDBCache << 20 );
@@ -1341,7 +1341,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1341
1341
nCoinDBCache = std::min (nCoinDBCache, nMaxCoinsDBCache << 20 ); // cap total coins db cache
1342
1342
nTotalCache -= nCoinDBCache;
1343
1343
int64_t nCoinCacheUsage = nTotalCache; // the rest goes to in-memory cache
1344
- int64_t nMempoolSizeMax = args.GetArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 ;
1344
+ int64_t nMempoolSizeMax = args.GetIntArg (" -maxmempool" , DEFAULT_MAX_MEMPOOL_SIZE) * 1000000 ;
1345
1345
LogPrintf (" Cache configuration:\n " );
1346
1346
LogPrintf (" * Using %.1f MiB for block index database\n " , nBlockTreeDBCache * (1.0 / 1024 / 1024 ));
1347
1347
if (args.GetBoolArg (" -txindex" , DEFAULT_TXINDEX)) {
@@ -1497,7 +1497,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1497
1497
for (CChainState* chainstate : chainman.GetAll ()) {
1498
1498
if (!is_coinsview_empty (chainstate)) {
1499
1499
uiInterface.InitMessage (_ (" Verifying blocks…" ).translated );
1500
- if (fHavePruned && args.GetArg (" -checkblocks" , DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) {
1500
+ if (fHavePruned && args.GetIntArg (" -checkblocks" , DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) {
1501
1501
LogPrintf (" Prune: pruned datadir may not have more than %d blocks; only checking available blocks\n " ,
1502
1502
MIN_BLOCKS_TO_KEEP);
1503
1503
}
@@ -1514,8 +1514,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1514
1514
1515
1515
if (!CVerifyDB ().VerifyDB (
1516
1516
*chainstate, chainparams, chainstate->CoinsDB (),
1517
- args.GetArg (" -checklevel" , DEFAULT_CHECKLEVEL),
1518
- args.GetArg (" -checkblocks" , DEFAULT_CHECKBLOCKS))) {
1517
+ args.GetIntArg (" -checklevel" , DEFAULT_CHECKLEVEL),
1518
+ args.GetIntArg (" -checkblocks" , DEFAULT_CHECKBLOCKS))) {
1519
1519
strLoadError = _ (" Corrupted block database detected" );
1520
1520
failed_verification = true ;
1521
1521
break ;
@@ -1707,11 +1707,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1707
1707
connOptions.uiInterface = &uiInterface;
1708
1708
connOptions.m_banman = node.banman .get ();
1709
1709
connOptions.m_msgproc = node.peerman .get ();
1710
- connOptions.nSendBufferMaxSize = 1000 * args.GetArg (" -maxsendbuffer" , DEFAULT_MAXSENDBUFFER);
1711
- connOptions.nReceiveFloodSize = 1000 * args.GetArg (" -maxreceivebuffer" , DEFAULT_MAXRECEIVEBUFFER);
1710
+ connOptions.nSendBufferMaxSize = 1000 * args.GetIntArg (" -maxsendbuffer" , DEFAULT_MAXSENDBUFFER);
1711
+ connOptions.nReceiveFloodSize = 1000 * args.GetIntArg (" -maxreceivebuffer" , DEFAULT_MAXRECEIVEBUFFER);
1712
1712
connOptions.m_added_nodes = args.GetArgs (" -addnode" );
1713
1713
1714
- connOptions.nMaxOutboundLimit = 1024 * 1024 * args.GetArg (" -maxuploadtarget" , DEFAULT_MAX_UPLOAD_TARGET);
1714
+ connOptions.nMaxOutboundLimit = 1024 * 1024 * args.GetIntArg (" -maxuploadtarget" , DEFAULT_MAX_UPLOAD_TARGET);
1715
1715
connOptions.m_peer_connect_timeout = peer_connect_timeout;
1716
1716
1717
1717
for (const std::string& bind_arg : args.GetArgs (" -bind" )) {
0 commit comments