@@ -746,7 +746,7 @@ void InitParameterInteraction()
746
746
LogPrintf (" %s: parameter interaction: -whitebind set -> setting -listen=1\n " , __func__);
747
747
}
748
748
749
- if (mapMultiArgs. count (" -connect" ) && mapMultiArgs. at ( " -connect " ). size () > 0 ) {
749
+ if (gArgs . IsArgSet (" -connect" )) {
750
750
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
751
751
if (SoftSetBoolArg (" -dnsseed" , false ))
752
752
LogPrintf (" %s: parameter interaction: -connect set -> setting -dnsseed=0\n " , __func__);
@@ -900,8 +900,8 @@ bool AppInitParameterInteraction()
900
900
901
901
// Make sure enough file descriptors are available
902
902
int nBind = std::max (
903
- (mapMultiArgs. count (" -bind" ) ? mapMultiArgs. at (" -bind" ).size () : 0 ) +
904
- (mapMultiArgs. count (" -whitebind" ) ? mapMultiArgs. at (" -whitebind" ).size () : 0 ), size_t (1 ));
903
+ (gArgs . IsArgSet (" -bind" ) ? gArgs . GetArgs (" -bind" ).size () : 0 ) +
904
+ (gArgs . IsArgSet (" -whitebind" ) ? gArgs . GetArgs (" -whitebind" ).size () : 0 ), size_t (1 ));
905
905
nUserMaxConnections = GetArg (" -maxconnections" , DEFAULT_MAX_PEER_CONNECTIONS);
906
906
nMaxConnections = std::max (nUserMaxConnections, 0 );
907
907
@@ -916,9 +916,9 @@ bool AppInitParameterInteraction()
916
916
InitWarning (strprintf (_ (" Reducing -maxconnections from %d to %d, because of system limitations." ), nUserMaxConnections, nMaxConnections));
917
917
918
918
// ********************************************************* Step 3: parameter-to-internal-flags
919
- if (mapMultiArgs. count (" -debug" ) > 0 ) {
919
+ if (gArgs . IsArgSet (" -debug" )) {
920
920
// Special-case: if -debug=0/-nodebug is set, turn off debugging messages
921
- const std::vector<std::string>& categories = mapMultiArgs. at (" -debug" );
921
+ const std::vector<std::string> categories = gArgs . GetArgs (" -debug" );
922
922
923
923
if (find (categories.begin (), categories.end (), std::string (" 0" )) == categories.end ()) {
924
924
for (const auto & cat : categories) {
@@ -933,9 +933,8 @@ bool AppInitParameterInteraction()
933
933
}
934
934
935
935
// Now remove the logging categories which were explicitly excluded
936
- if (mapMultiArgs.count (" -debugexclude" ) > 0 ) {
937
- const std::vector<std::string>& excludedCategories = mapMultiArgs.at (" -debugexclude" );
938
- for (const auto & cat : excludedCategories) {
936
+ if (gArgs .IsArgSet (" -debugexclude" )) {
937
+ for (const std::string& cat : gArgs .GetArgs (" -debugexclude" )) {
939
938
uint32_t flag = 0 ;
940
939
if (!GetLogCategory (&flag, &cat)) {
941
940
InitWarning (strprintf (_ (" Unsupported logging category %s=%s." ), " -debugexclude" , cat));
@@ -1105,15 +1104,14 @@ bool AppInitParameterInteraction()
1105
1104
fEnableReplacement = (std::find (vstrReplacementModes.begin (), vstrReplacementModes.end (), " fee" ) != vstrReplacementModes.end ());
1106
1105
}
1107
1106
1108
- if (mapMultiArgs. count (" -bip9params" )) {
1107
+ if (gArgs . IsArgSet (" -bip9params" )) {
1109
1108
// Allow overriding BIP9 parameters for testing
1110
1109
if (!chainparams.MineBlocksOnDemand ()) {
1111
1110
return InitError (" BIP9 parameters may only be overridden on regtest." );
1112
1111
}
1113
- const std::vector<std::string>& deployments = mapMultiArgs.at (" -bip9params" );
1114
- for (auto i : deployments) {
1112
+ for (const std::string& strDeployment : gArgs .GetArgs (" -bip9params" )) {
1115
1113
std::vector<std::string> vDeploymentParams;
1116
- boost::split (vDeploymentParams, i , boost::is_any_of (" :" ));
1114
+ boost::split (vDeploymentParams, strDeployment , boost::is_any_of (" :" ));
1117
1115
if (vDeploymentParams.size () != 3 ) {
1118
1116
return InitError (" BIP9 parameters malformed, expecting deployment:start:end" );
1119
1117
}
@@ -1259,8 +1257,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1259
1257
1260
1258
// sanitize comments per BIP-0014, format user agent and check total size
1261
1259
std::vector<std::string> uacomments;
1262
- if (mapMultiArgs. count (" -uacomment" )) {
1263
- BOOST_FOREACH (std::string cmt, mapMultiArgs. at (" -uacomment" ))
1260
+ if (gArgs . IsArgSet (" -uacomment" )) {
1261
+ BOOST_FOREACH (std::string cmt, gArgs . GetArgs (" -uacomment" ))
1264
1262
{
1265
1263
if (cmt != SanitizeString (cmt, SAFE_CHARS_UA_COMMENT))
1266
1264
return InitError (strprintf (_ (" User Agent comment (%s) contains unsafe characters." ), cmt));
@@ -1273,9 +1271,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1273
1271
strSubVersion.size (), MAX_SUBVERSION_LENGTH));
1274
1272
}
1275
1273
1276
- if (mapMultiArgs. count (" -onlynet" )) {
1274
+ if (gArgs . IsArgSet (" -onlynet" )) {
1277
1275
std::set<enum Network> nets;
1278
- BOOST_FOREACH (const std::string& snet, mapMultiArgs. at (" -onlynet" )) {
1276
+ BOOST_FOREACH (const std::string& snet, gArgs . GetArgs (" -onlynet" )) {
1279
1277
enum Network net = ParseNetwork (snet);
1280
1278
if (net == NET_UNROUTABLE)
1281
1279
return InitError (strprintf (_ (" Unknown network specified in -onlynet: '%s'" ), snet));
@@ -1288,8 +1286,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1288
1286
}
1289
1287
}
1290
1288
1291
- if (mapMultiArgs. count (" -whitelist" )) {
1292
- BOOST_FOREACH (const std::string& net, mapMultiArgs. at (" -whitelist" )) {
1289
+ if (gArgs . IsArgSet (" -whitelist" )) {
1290
+ BOOST_FOREACH (const std::string& net, gArgs . GetArgs (" -whitelist" )) {
1293
1291
CSubNet subnet;
1294
1292
LookupSubNet (net.c_str (), subnet);
1295
1293
if (!subnet.IsValid ())
@@ -1350,16 +1348,16 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1350
1348
1351
1349
if (fListen ) {
1352
1350
bool fBound = false ;
1353
- if (mapMultiArgs. count (" -bind" )) {
1354
- BOOST_FOREACH (const std::string& strBind, mapMultiArgs. at (" -bind" )) {
1351
+ if (gArgs . IsArgSet (" -bind" )) {
1352
+ BOOST_FOREACH (const std::string& strBind, gArgs . GetArgs (" -bind" )) {
1355
1353
CService addrBind;
1356
1354
if (!Lookup (strBind.c_str (), addrBind, GetListenPort (), false ))
1357
1355
return InitError (ResolveErrMsg (" bind" , strBind));
1358
1356
fBound |= Bind (connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR));
1359
1357
}
1360
1358
}
1361
- if (mapMultiArgs. count (" -whitebind" )) {
1362
- BOOST_FOREACH (const std::string& strBind, mapMultiArgs. at (" -whitebind" )) {
1359
+ if (gArgs . IsArgSet (" -whitebind" )) {
1360
+ BOOST_FOREACH (const std::string& strBind, gArgs . GetArgs (" -whitebind" )) {
1363
1361
CService addrBind;
1364
1362
if (!Lookup (strBind.c_str (), addrBind, 0 , false ))
1365
1363
return InitError (ResolveErrMsg (" whitebind" , strBind));
@@ -1368,7 +1366,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1368
1366
fBound |= Bind (connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR | BF_WHITELIST));
1369
1367
}
1370
1368
}
1371
- if (!mapMultiArgs. count (" -bind" ) && !mapMultiArgs. count (" -whitebind" )) {
1369
+ if (!gArgs . IsArgSet (" -bind" ) && !gArgs . IsArgSet (" -whitebind" )) {
1372
1370
struct in_addr inaddr_any;
1373
1371
inaddr_any.s_addr = INADDR_ANY;
1374
1372
fBound |= Bind (connman, CService (in6addr_any, GetListenPort ()), BF_NONE);
@@ -1378,8 +1376,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1378
1376
return InitError (_ (" Failed to listen on any port. Use -listen=0 if you want this." ));
1379
1377
}
1380
1378
1381
- if (mapMultiArgs. count (" -externalip" )) {
1382
- BOOST_FOREACH (const std::string& strAddr, mapMultiArgs. at (" -externalip" )) {
1379
+ if (gArgs . IsArgSet (" -externalip" )) {
1380
+ BOOST_FOREACH (const std::string& strAddr, gArgs . GetArgs (" -externalip" )) {
1383
1381
CService addrLocal;
1384
1382
if (Lookup (strAddr.c_str (), addrLocal, GetListenPort (), fNameLookup ) && addrLocal.IsValid ())
1385
1383
AddLocal (addrLocal, LOCAL_MANUAL);
@@ -1388,8 +1386,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1388
1386
}
1389
1387
}
1390
1388
1391
- if (mapMultiArgs. count (" -seednode" )) {
1392
- BOOST_FOREACH (const std::string& strDest, mapMultiArgs. at (" -seednode" ))
1389
+ if (gArgs . IsArgSet (" -seednode" )) {
1390
+ BOOST_FOREACH (const std::string& strDest, gArgs . GetArgs (" -seednode" ))
1393
1391
connman.AddOneShot (strDest);
1394
1392
}
1395
1393
@@ -1615,9 +1613,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1615
1613
uiInterface.NotifyBlockTip .connect (BlockNotifyCallback);
1616
1614
1617
1615
std::vector<fs::path> vImportFiles;
1618
- if (mapMultiArgs. count (" -loadblock" ))
1616
+ if (gArgs . IsArgSet (" -loadblock" ))
1619
1617
{
1620
- BOOST_FOREACH (const std::string& strFile, mapMultiArgs. at (" -loadblock" ))
1618
+ BOOST_FOREACH (const std::string& strFile, gArgs . GetArgs (" -loadblock" ))
1621
1619
vImportFiles.push_back (strFile);
1622
1620
}
1623
1621
0 commit comments