Skip to content

Commit 7aa7004

Browse files
committed
Merge #9243: Clean up mapArgs and mapMultiArgs Usage
c2f61be Add a ForceSetArg method for testing (Matt Corallo) 4e04814 Lock mapArgs/mapMultiArgs access in util (Matt Corallo) 4cd373a Un-expose mapArgs from utils.h (Matt Corallo) 71fde55 Get rid of mapArgs direct access in ZMQ construction (Matt Corallo) 0cf86a6 Introduce (and use) an IsArgSet accessor method (Matt Corallo) 2b5f085 Fix non-const mapMultiArgs[] access after init. (Matt Corallo) c8042a4 Remove arguments to ParseConfigFile (Matt Corallo)
2 parents dbc8a8c + c2f61be commit 7aa7004

20 files changed

+173
-124
lines changed

src/bitcoin-cli.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ static int AppInitRPC(int argc, char* argv[])
7676
// Parameters
7777
//
7878
ParseParameters(argc, argv);
79-
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) {
79+
if (argc<2 || IsArgSet("-?") || IsArgSet("-h") || IsArgSet("-help") || IsArgSet("-version")) {
8080
std::string strUsage = strprintf(_("%s RPC client version"), _(PACKAGE_NAME)) + " " + FormatFullVersion() + "\n";
81-
if (!mapArgs.count("-version")) {
81+
if (!IsArgSet("-version")) {
8282
strUsage += "\n" + _("Usage:") + "\n" +
8383
" bitcoin-cli [options] <command> [params] " + strprintf(_("Send command to %s"), _(PACKAGE_NAME)) + "\n" +
8484
" bitcoin-cli [options] help " + _("List commands") + "\n" +
@@ -95,11 +95,11 @@ static int AppInitRPC(int argc, char* argv[])
9595
return EXIT_SUCCESS;
9696
}
9797
if (!boost::filesystem::is_directory(GetDataDir(false))) {
98-
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
98+
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", GetArg("-datadir", "").c_str());
9999
return EXIT_FAILURE;
100100
}
101101
try {
102-
ReadConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME), mapArgs, mapMultiArgs);
102+
ReadConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME));
103103
} catch (const std::exception& e) {
104104
fprintf(stderr,"Error reading configuration file: %s\n", e.what());
105105
return EXIT_FAILURE;
@@ -211,7 +211,7 @@ UniValue CallRPC(const std::string& strMethod, const UniValue& params)
211211

212212
// Get credentials
213213
std::string strRPCUserColonPass;
214-
if (mapArgs["-rpcpassword"] == "") {
214+
if (GetArg("-rpcpassword", "") == "") {
215215
// Try fall back to cookie-based authentication if no password is provided
216216
if (!GetAuthCookie(&strRPCUserColonPass)) {
217217
throw std::runtime_error(strprintf(
@@ -220,7 +220,7 @@ UniValue CallRPC(const std::string& strMethod, const UniValue& params)
220220

221221
}
222222
} else {
223-
strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
223+
strRPCUserColonPass = GetArg("-rpcuser", "") + ":" + GetArg("-rpcpassword", "");
224224
}
225225

226226
struct evkeyvalq *output_headers = evhttp_request_get_output_headers(req);

src/bitcoin-tx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static int AppInitRawTx(int argc, char* argv[])
5151

5252
fCreateBlank = GetBoolArg("-create", false);
5353

54-
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help"))
54+
if (argc<2 || IsArgSet("-?") || IsArgSet("-h") || IsArgSet("-help"))
5555
{
5656
// First part of help message is specific to this utility
5757
std::string strUsage = strprintf(_("%s bitcoin-tx utility version"), _(PACKAGE_NAME)) + " " + FormatFullVersion() + "\n\n" +

src/bitcoind.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ bool AppInit(int argc, char* argv[])
7575
ParseParameters(argc, argv);
7676

7777
// Process help and version before taking care about datadir
78-
if (mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version"))
78+
if (IsArgSet("-?") || IsArgSet("-h") || IsArgSet("-help") || IsArgSet("-version"))
7979
{
8080
std::string strUsage = strprintf(_("%s Daemon"), _(PACKAGE_NAME)) + " " + _("version") + " " + FormatFullVersion() + "\n";
8181

82-
if (mapArgs.count("-version"))
82+
if (IsArgSet("-version"))
8383
{
8484
strUsage += FormatParagraph(LicenseInfo());
8585
}
@@ -99,12 +99,12 @@ bool AppInit(int argc, char* argv[])
9999
{
100100
if (!boost::filesystem::is_directory(GetDataDir(false)))
101101
{
102-
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
102+
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", GetArg("-datadir", "").c_str());
103103
return false;
104104
}
105105
try
106106
{
107-
ReadConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME), mapArgs, mapMultiArgs);
107+
ReadConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME));
108108
} catch (const std::exception& e) {
109109
fprintf(stderr,"Error reading configuration file: %s\n", e.what());
110110
return false;

src/httprpc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static bool multiUserAuthorized(std::string strUserPass)
9595

9696
if (mapMultiArgs.count("-rpcauth") > 0) {
9797
//Search for multi-user login/pass "rpcauth" from config
98-
BOOST_FOREACH(std::string strRPCAuth, mapMultiArgs["-rpcauth"])
98+
BOOST_FOREACH(std::string strRPCAuth, mapMultiArgs.at("-rpcauth"))
9999
{
100100
std::vector<std::string> vFields;
101101
boost::split(vFields, strRPCAuth, boost::is_any_of(":$"));
@@ -215,7 +215,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
215215

216216
static bool InitRPCAuthentication()
217217
{
218-
if (mapArgs["-rpcpassword"] == "")
218+
if (GetArg("-rpcpassword", "") == "")
219219
{
220220
LogPrintf("No rpcpassword set - using random cookie authentication\n");
221221
if (!GenerateAuthCookie(&strRPCUserColonPass)) {
@@ -226,7 +226,7 @@ static bool InitRPCAuthentication()
226226
}
227227
} else {
228228
LogPrintf("Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.\n");
229-
strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
229+
strRPCUserColonPass = GetArg("-rpcuser", "") + ":" + GetArg("-rpcpassword", "");
230230
}
231231
return true;
232232
}

src/httpserver.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static bool InitHTTPAllowList()
204204
rpc_allow_subnets.push_back(CSubNet(localv4, 8)); // always allow IPv4 local subnet
205205
rpc_allow_subnets.push_back(CSubNet(localv6)); // always allow IPv6 localhost
206206
if (mapMultiArgs.count("-rpcallowip")) {
207-
const std::vector<std::string>& vAllow = mapMultiArgs["-rpcallowip"];
207+
const std::vector<std::string>& vAllow = mapMultiArgs.at("-rpcallowip");
208208
for (std::string strAllow : vAllow) {
209209
CSubNet subnet;
210210
LookupSubNet(strAllow.c_str(), subnet);
@@ -322,14 +322,14 @@ static bool HTTPBindAddresses(struct evhttp* http)
322322
std::vector<std::pair<std::string, uint16_t> > endpoints;
323323

324324
// Determine what addresses to bind to
325-
if (!mapArgs.count("-rpcallowip")) { // Default to loopback if not allowing external IPs
325+
if (!IsArgSet("-rpcallowip")) { // Default to loopback if not allowing external IPs
326326
endpoints.push_back(std::make_pair("::1", defaultPort));
327327
endpoints.push_back(std::make_pair("127.0.0.1", defaultPort));
328-
if (mapArgs.count("-rpcbind")) {
328+
if (IsArgSet("-rpcbind")) {
329329
LogPrintf("WARNING: option -rpcbind was ignored because -rpcallowip was not specified, refusing to allow everyone to connect\n");
330330
}
331-
} else if (mapArgs.count("-rpcbind")) { // Specific bind address
332-
const std::vector<std::string>& vbind = mapMultiArgs["-rpcbind"];
331+
} else if (mapMultiArgs.count("-rpcbind")) { // Specific bind address
332+
const std::vector<std::string>& vbind = mapMultiArgs.at("-rpcbind");
333333
for (std::vector<std::string>::const_iterator i = vbind.begin(); i != vbind.end(); ++i) {
334334
int port = defaultPort;
335335
std::string host;

src/init.cpp

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -708,24 +708,24 @@ void InitParameterInteraction()
708708
{
709709
// when specifying an explicit binding address, you want to listen on it
710710
// even when -connect or -proxy is specified
711-
if (mapArgs.count("-bind")) {
711+
if (IsArgSet("-bind")) {
712712
if (SoftSetBoolArg("-listen", true))
713713
LogPrintf("%s: parameter interaction: -bind set -> setting -listen=1\n", __func__);
714714
}
715-
if (mapArgs.count("-whitebind")) {
715+
if (IsArgSet("-whitebind")) {
716716
if (SoftSetBoolArg("-listen", true))
717717
LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__);
718718
}
719719

720-
if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) {
720+
if (mapMultiArgs.count("-connect") && mapMultiArgs.at("-connect").size() > 0) {
721721
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
722722
if (SoftSetBoolArg("-dnsseed", false))
723723
LogPrintf("%s: parameter interaction: -connect set -> setting -dnsseed=0\n", __func__);
724724
if (SoftSetBoolArg("-listen", false))
725725
LogPrintf("%s: parameter interaction: -connect set -> setting -listen=0\n", __func__);
726726
}
727727

728-
if (mapArgs.count("-proxy")) {
728+
if (IsArgSet("-proxy")) {
729729
// to protect privacy, do not listen by default if a default proxy server is specified
730730
if (SoftSetBoolArg("-listen", false))
731731
LogPrintf("%s: parameter interaction: -proxy set -> setting -listen=0\n", __func__);
@@ -748,7 +748,7 @@ void InitParameterInteraction()
748748
LogPrintf("%s: parameter interaction: -listen=0 -> setting -listenonion=0\n", __func__);
749749
}
750750

751-
if (mapArgs.count("-externalip")) {
751+
if (IsArgSet("-externalip")) {
752752
// if an explicit public IP is specified, do not try to find others
753753
if (SoftSetBoolArg("-discover", false))
754754
LogPrintf("%s: parameter interaction: -externalip set -> setting -discover=0\n", __func__);
@@ -880,17 +880,19 @@ bool AppInitParameterInteraction()
880880

881881
// ********************************************************* Step 3: parameter-to-internal-flags
882882

883-
fDebug = !mapMultiArgs["-debug"].empty();
883+
fDebug = mapMultiArgs.count("-debug");
884884
// Special-case: if -debug=0/-nodebug is set, turn off debugging messages
885-
const vector<string>& categories = mapMultiArgs["-debug"];
886-
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), string("0")) != categories.end())
887-
fDebug = false;
885+
if (fDebug) {
886+
const vector<string>& categories = mapMultiArgs.at("-debug");
887+
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), string("0")) != categories.end())
888+
fDebug = false;
889+
}
888890

889891
// Check for -debugnet
890892
if (GetBoolArg("-debugnet", false))
891893
InitWarning(_("Unsupported argument -debugnet ignored, use -debug=net."));
892894
// Check for -socks - as this is a privacy risk to continue, exit here
893-
if (mapArgs.count("-socks"))
895+
if (IsArgSet("-socks"))
894896
return InitError(_("Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported."));
895897
// Check for -tor - as this is a privacy risk to continue, exit here
896898
if (GetBoolArg("-tor", false))
@@ -902,7 +904,7 @@ bool AppInitParameterInteraction()
902904
if (GetBoolArg("-whitelistalwaysrelay", false))
903905
InitWarning(_("Unsupported argument -whitelistalwaysrelay ignored, use -whitelistrelay and/or -whitelistforcerelay."));
904906

905-
if (mapArgs.count("-blockminsize"))
907+
if (IsArgSet("-blockminsize"))
906908
InitWarning("Unsupported argument -blockminsize ignored.");
907909

908910
// Checkmempool and checkblockindex default to true in regtest mode
@@ -957,11 +959,11 @@ bool AppInitParameterInteraction()
957959
// a transaction spammer can cheaply fill blocks using
958960
// 1-satoshi-fee transactions. It should be set above the real
959961
// cost to you of processing a transaction.
960-
if (mapArgs.count("-minrelaytxfee"))
962+
if (IsArgSet("-minrelaytxfee"))
961963
{
962964
CAmount n = 0;
963-
if (!ParseMoney(mapArgs["-minrelaytxfee"], n) || 0 == n)
964-
return InitError(AmountErrMsg("minrelaytxfee", mapArgs["-minrelaytxfee"]));
965+
if (!ParseMoney(GetArg("-minrelaytxfee", ""), n) || 0 == n)
966+
return InitError(AmountErrMsg("minrelaytxfee", GetArg("-minrelaytxfee", "")));
965967
// High fee check is done afterward in CWallet::ParameterInteraction()
966968
::minRelayTxFee = CFeeRate(n);
967969
}
@@ -995,20 +997,20 @@ bool AppInitParameterInteraction()
995997
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
996998

997999
fEnableReplacement = GetBoolArg("-mempoolreplacement", DEFAULT_ENABLE_REPLACEMENT);
998-
if ((!fEnableReplacement) && mapArgs.count("-mempoolreplacement")) {
1000+
if ((!fEnableReplacement) && IsArgSet("-mempoolreplacement")) {
9991001
// Minimal effort at forwards compatibility
10001002
std::string strReplacementModeList = GetArg("-mempoolreplacement", ""); // default is impossible
10011003
std::vector<std::string> vstrReplacementModes;
10021004
boost::split(vstrReplacementModes, strReplacementModeList, boost::is_any_of(","));
10031005
fEnableReplacement = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "fee") != vstrReplacementModes.end());
10041006
}
10051007

1006-
if (!mapMultiArgs["-bip9params"].empty()) {
1008+
if (mapMultiArgs.count("-bip9params")) {
10071009
// Allow overriding BIP9 parameters for testing
10081010
if (!chainparams.MineBlocksOnDemand()) {
10091011
return InitError("BIP9 parameters may only be overridden on regtest.");
10101012
}
1011-
const vector<string>& deployments = mapMultiArgs["-bip9params"];
1013+
const vector<string>& deployments = mapMultiArgs.at("-bip9params");
10121014
for (auto i : deployments) {
10131015
std::vector<std::string> vDeploymentParams;
10141016
boost::split(vDeploymentParams, i, boost::is_any_of(":"));
@@ -1154,21 +1156,23 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
11541156

11551157
// sanitize comments per BIP-0014, format user agent and check total size
11561158
std::vector<string> uacomments;
1157-
BOOST_FOREACH(string cmt, mapMultiArgs["-uacomment"])
1158-
{
1159-
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
1160-
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
1161-
uacomments.push_back(SanitizeString(cmt, SAFE_CHARS_UA_COMMENT));
1159+
if (mapMultiArgs.count("-uacomment")) {
1160+
BOOST_FOREACH(string cmt, mapMultiArgs.at("-uacomment"))
1161+
{
1162+
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
1163+
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
1164+
uacomments.push_back(cmt);
1165+
}
11621166
}
11631167
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments);
11641168
if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) {
11651169
return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments."),
11661170
strSubVersion.size(), MAX_SUBVERSION_LENGTH));
11671171
}
11681172

1169-
if (mapArgs.count("-onlynet")) {
1173+
if (mapMultiArgs.count("-onlynet")) {
11701174
std::set<enum Network> nets;
1171-
BOOST_FOREACH(const std::string& snet, mapMultiArgs["-onlynet"]) {
1175+
BOOST_FOREACH(const std::string& snet, mapMultiArgs.at("-onlynet")) {
11721176
enum Network net = ParseNetwork(snet);
11731177
if (net == NET_UNROUTABLE)
11741178
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
@@ -1181,8 +1185,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
11811185
}
11821186
}
11831187

1184-
if (mapArgs.count("-whitelist")) {
1185-
BOOST_FOREACH(const std::string& net, mapMultiArgs["-whitelist"]) {
1188+
if (mapMultiArgs.count("-whitelist")) {
1189+
BOOST_FOREACH(const std::string& net, mapMultiArgs.at("-whitelist")) {
11861190
CSubNet subnet;
11871191
LookupSubNet(net.c_str(), subnet);
11881192
if (!subnet.IsValid())
@@ -1234,14 +1238,16 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12341238

12351239
if (fListen) {
12361240
bool fBound = false;
1237-
if (mapArgs.count("-bind") || mapArgs.count("-whitebind")) {
1238-
BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-bind"]) {
1241+
if (mapMultiArgs.count("-bind")) {
1242+
BOOST_FOREACH(const std::string& strBind, mapMultiArgs.at("-bind")) {
12391243
CService addrBind;
12401244
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false))
12411245
return InitError(ResolveErrMsg("bind", strBind));
12421246
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR));
12431247
}
1244-
BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-whitebind"]) {
1248+
}
1249+
if (mapMultiArgs.count("-whitebind")) {
1250+
BOOST_FOREACH(const std::string& strBind, mapMultiArgs.at("-whitebind")) {
12451251
CService addrBind;
12461252
if (!Lookup(strBind.c_str(), addrBind, 0, false))
12471253
return InitError(ResolveErrMsg("whitebind", strBind));
@@ -1250,7 +1256,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12501256
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR | BF_WHITELIST));
12511257
}
12521258
}
1253-
else {
1259+
if (!mapMultiArgs.count("-bind") && !mapMultiArgs.count("-whitebind")) {
12541260
struct in_addr inaddr_any;
12551261
inaddr_any.s_addr = INADDR_ANY;
12561262
fBound |= Bind(connman, CService(in6addr_any, GetListenPort()), BF_NONE);
@@ -1260,8 +1266,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12601266
return InitError(_("Failed to listen on any port. Use -listen=0 if you want this."));
12611267
}
12621268

1263-
if (mapArgs.count("-externalip")) {
1264-
BOOST_FOREACH(const std::string& strAddr, mapMultiArgs["-externalip"]) {
1269+
if (mapMultiArgs.count("-externalip")) {
1270+
BOOST_FOREACH(const std::string& strAddr, mapMultiArgs.at("-externalip")) {
12651271
CService addrLocal;
12661272
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
12671273
AddLocal(addrLocal, LOCAL_MANUAL);
@@ -1270,11 +1276,13 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12701276
}
12711277
}
12721278

1273-
BOOST_FOREACH(const std::string& strDest, mapMultiArgs["-seednode"])
1274-
connman.AddOneShot(strDest);
1279+
if (mapMultiArgs.count("-seednode")) {
1280+
BOOST_FOREACH(const std::string& strDest, mapMultiArgs.at("-seednode"))
1281+
connman.AddOneShot(strDest);
1282+
}
12751283

12761284
#if ENABLE_ZMQ
1277-
pzmqNotificationInterface = CZMQNotificationInterface::CreateWithArguments(mapArgs);
1285+
pzmqNotificationInterface = CZMQNotificationInterface::Create();
12781286

12791287
if (pzmqNotificationInterface) {
12801288
RegisterValidationInterface(pzmqNotificationInterface);
@@ -1283,7 +1291,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
12831291
uint64_t nMaxOutboundLimit = 0; //unlimited unless -maxuploadtarget is set
12841292
uint64_t nMaxOutboundTimeframe = MAX_UPLOAD_TIMEFRAME;
12851293

1286-
if (mapArgs.count("-maxuploadtarget")) {
1294+
if (IsArgSet("-maxuploadtarget")) {
12871295
nMaxOutboundLimit = GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET)*1024*1024;
12881296
}
12891297

@@ -1515,13 +1523,13 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
15151523
fHaveGenesis = true;
15161524
}
15171525

1518-
if (mapArgs.count("-blocknotify"))
1526+
if (IsArgSet("-blocknotify"))
15191527
uiInterface.NotifyBlockTip.connect(BlockNotifyCallback);
15201528

15211529
std::vector<boost::filesystem::path> vImportFiles;
1522-
if (mapArgs.count("-loadblock"))
1530+
if (mapMultiArgs.count("-loadblock"))
15231531
{
1524-
BOOST_FOREACH(const std::string& strFile, mapMultiArgs["-loadblock"])
1532+
BOOST_FOREACH(const std::string& strFile, mapMultiArgs.at("-loadblock"))
15251533
vImportFiles.push_back(strFile);
15261534
}
15271535

src/miner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ BlockAssembler::BlockAssembler(const CChainParams& _chainparams)
8484
nBlockMaxWeight = DEFAULT_BLOCK_MAX_WEIGHT;
8585
nBlockMaxSize = DEFAULT_BLOCK_MAX_SIZE;
8686
bool fWeightSet = false;
87-
if (mapArgs.count("-blockmaxweight")) {
87+
if (IsArgSet("-blockmaxweight")) {
8888
nBlockMaxWeight = GetArg("-blockmaxweight", DEFAULT_BLOCK_MAX_WEIGHT);
8989
nBlockMaxSize = MAX_BLOCK_SERIALIZED_SIZE;
9090
fWeightSet = true;
9191
}
92-
if (mapArgs.count("-blockmaxsize")) {
92+
if (IsArgSet("-blockmaxsize")) {
9393
nBlockMaxSize = GetArg("-blockmaxsize", DEFAULT_BLOCK_MAX_SIZE);
9494
if (!fWeightSet) {
9595
nBlockMaxWeight = nBlockMaxSize * WITNESS_SCALE_FACTOR;

0 commit comments

Comments
 (0)