@@ -880,9 +880,7 @@ bool AppInitParameterInteraction()
880
880
}
881
881
882
882
// -bind and -whitebind can't be set when not listening
883
- size_t nUserBind =
884
- (gArgs .IsArgSet (" -bind" ) ? gArgs .GetArgs (" -bind" ).size () : 0 ) +
885
- (gArgs .IsArgSet (" -whitebind" ) ? gArgs .GetArgs (" -whitebind" ).size () : 0 );
883
+ size_t nUserBind = gArgs .GetArgs (" -bind" ).size () + gArgs .GetArgs (" -whitebind" ).size ();
886
884
if (nUserBind != 0 && !gArgs .GetBoolArg (" -listen" , DEFAULT_LISTEN)) {
887
885
return InitError (" Cannot set -bind or -whitebind together with -listen=0" );
888
886
}
@@ -920,15 +918,13 @@ bool AppInitParameterInteraction()
920
918
}
921
919
922
920
// Now remove the logging categories which were explicitly excluded
923
- if (gArgs .IsArgSet (" -debugexclude" )) {
924
- for (const std::string& cat : gArgs .GetArgs (" -debugexclude" )) {
921
+ for (const std::string& cat : gArgs .GetArgs (" -debugexclude" )) {
925
922
uint32_t flag = 0 ;
926
923
if (!GetLogCategory (&flag, &cat)) {
927
924
InitWarning (strprintf (_ (" Unsupported logging category %s=%s." ), " -debugexclude" , cat));
928
925
continue ;
929
926
}
930
927
logCategories &= ~flag;
931
- }
932
928
}
933
929
934
930
// Check for -debugnet
@@ -1238,13 +1234,10 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1238
1234
1239
1235
// sanitize comments per BIP-0014, format user agent and check total size
1240
1236
std::vector<std::string> uacomments;
1241
- if (gArgs .IsArgSet (" -uacomment" )) {
1242
- for (std::string cmt : gArgs .GetArgs (" -uacomment" ))
1243
- {
1237
+ for (const std::string& cmt : gArgs .GetArgs (" -uacomment" )) {
1244
1238
if (cmt != SanitizeString (cmt, SAFE_CHARS_UA_COMMENT))
1245
1239
return InitError (strprintf (_ (" User Agent comment (%s) contains unsafe characters." ), cmt));
1246
1240
uacomments.push_back (cmt);
1247
- }
1248
1241
}
1249
1242
strSubVersion = FormatSubVersion (CLIENT_NAME, CLIENT_VERSION, uacomments);
1250
1243
if (strSubVersion.size () > MAX_SUBVERSION_LENGTH) {
@@ -1317,14 +1310,12 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1317
1310
fDiscover = GetBoolArg (" -discover" , true );
1318
1311
fRelayTxes = !GetBoolArg (" -blocksonly" , DEFAULT_BLOCKSONLY);
1319
1312
1320
- if (gArgs .IsArgSet (" -externalip" )) {
1321
- for (const std::string& strAddr : gArgs .GetArgs (" -externalip" )) {
1313
+ for (const std::string& strAddr : gArgs .GetArgs (" -externalip" )) {
1322
1314
CService addrLocal;
1323
1315
if (Lookup (strAddr.c_str (), addrLocal, GetListenPort (), fNameLookup ) && addrLocal.IsValid ())
1324
1316
AddLocal (addrLocal, LOCAL_MANUAL);
1325
1317
else
1326
1318
return InitError (ResolveErrMsg (" externalip" , strAddr));
1327
- }
1328
1319
}
1329
1320
1330
1321
#if ENABLE_ZMQ
@@ -1553,10 +1544,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1553
1544
uiInterface.NotifyBlockTip .connect (BlockNotifyCallback);
1554
1545
1555
1546
std::vector<fs::path> vImportFiles;
1556
- if (gArgs .IsArgSet (" -loadblock" ))
1557
- {
1558
- for (const std::string& strFile : gArgs .GetArgs (" -loadblock" ))
1559
- vImportFiles.push_back (strFile);
1547
+ for (const std::string& strFile : gArgs .GetArgs (" -loadblock" )) {
1548
+ vImportFiles.push_back (strFile);
1560
1549
}
1561
1550
1562
1551
threadGroup.create_thread (boost::bind (&ThreadImport, vImportFiles));
@@ -1598,17 +1587,14 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1598
1587
connOptions.nMaxOutboundTimeframe = nMaxOutboundTimeframe;
1599
1588
connOptions.nMaxOutboundLimit = nMaxOutboundLimit;
1600
1589
1601
- if (gArgs .IsArgSet (" -bind" )) {
1602
- for (const std::string& strBind : gArgs .GetArgs (" -bind" )) {
1590
+ for (const std::string& strBind : gArgs .GetArgs (" -bind" )) {
1603
1591
CService addrBind;
1604
1592
if (!Lookup (strBind.c_str (), addrBind, GetListenPort (), false )) {
1605
1593
return InitError (ResolveErrMsg (" bind" , strBind));
1606
1594
}
1607
1595
connOptions.vBinds .push_back (addrBind);
1608
- }
1609
1596
}
1610
- if (gArgs .IsArgSet (" -whitebind" )) {
1611
- for (const std::string& strBind : gArgs .GetArgs (" -whitebind" )) {
1597
+ for (const std::string& strBind : gArgs .GetArgs (" -whitebind" )) {
1612
1598
CService addrBind;
1613
1599
if (!Lookup (strBind.c_str (), addrBind, 0 , false )) {
1614
1600
return InitError (ResolveErrMsg (" whitebind" , strBind));
@@ -1617,17 +1603,14 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1617
1603
return InitError (strprintf (_ (" Need to specify a port with -whitebind: '%s'" ), strBind));
1618
1604
}
1619
1605
connOptions.vWhiteBinds .push_back (addrBind);
1620
- }
1621
1606
}
1622
1607
1623
- if (gArgs .IsArgSet (" -whitelist" )) {
1624
- for (const auto & net : gArgs .GetArgs (" -whitelist" )) {
1608
+ for (const auto & net : gArgs .GetArgs (" -whitelist" )) {
1625
1609
CSubNet subnet;
1626
1610
LookupSubNet (net.c_str (), subnet);
1627
1611
if (!subnet.IsValid ())
1628
1612
return InitError (strprintf (_ (" Invalid netmask specified in -whitelist: '%s'" ), net));
1629
1613
connOptions.vWhitelistedRange .push_back (subnet);
1630
- }
1631
1614
}
1632
1615
1633
1616
if (gArgs .IsArgSet (" -seednode" )) {
0 commit comments