Skip to content

Commit 825f4a6

Browse files
author
merge-script
committed
Merge bitcoin/bitcoin#22976: scripted-diff: Rename overloaded int GetArg to GetIntArg
93b9800 scripted-diff: Rename overloaded int GetArg to GetIntArg (Russell Yanofsky) Pull request description: This is meant to improve readability of code and remove guesswork needed to determine argument types and migrate to [typed arguments (#22978)](bitcoin/bitcoin#22978) by having distinctly named `GetArg` `GetArgs` `GetBoolArg` and `GetIntArg` methods. --- This commit was originally part of #22766 and had some review discussion there. But it was [wisely suggested](bitcoin/bitcoin#22766 (comment)) to be split off to make that PR smaller. ACKs for top commit: hebasto: ACK 93b9800. MarcoFalke: re-ACK 93b9800 📨 Tree-SHA512: e034bd938b2c8fbadd90bcd52213a61161965dfddf18c2cb0d68816ecf2438cde8afee6fb7e3418f5c6b35c208338da9deb99e4e418dbf68ca34552e0916a625
2 parents 68bbfcc + 93b9800 commit 825f4a6

26 files changed

+93
-93
lines changed

src/addrdb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void ReadFromStream(CAddrMan& addr, CDataStream& ssPeers)
183183

184184
std::optional<bilingual_str> LoadAddrman(const std::vector<bool>& asmap, const ArgsManager& args, std::unique_ptr<CAddrMan>& addrman)
185185
{
186-
auto check_addrman = std::clamp<int32_t>(args.GetArg("-checkaddrman", DEFAULT_ADDRMAN_CONSISTENCY_CHECKS), 0, 1000000);
186+
auto check_addrman = std::clamp<int32_t>(args.GetIntArg("-checkaddrman", DEFAULT_ADDRMAN_CONSISTENCY_CHECKS), 0, 1000000);
187187
addrman = std::make_unique<CAddrMan>(asmap, /* deterministic */ false, /* consistency_check_ratio */ check_addrman);
188188

189189
int64_t nStart = GetTimeMillis();

src/bench/bench_bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ int main(int argc, char** argv)
107107
benchmark::Args args;
108108
args.asymptote = parseAsymptote(argsman.GetArg("-asymptote", ""));
109109
args.is_list_only = argsman.GetBoolArg("-list", false);
110-
args.min_time = std::chrono::milliseconds(argsman.GetArg("-min_time", DEFAULT_MIN_TIME_MS));
110+
args.min_time = std::chrono::milliseconds(argsman.GetIntArg("-min_time", DEFAULT_MIN_TIME_MS));
111111
args.output_csv = argsman.GetArg("-output_csv", "");
112112
args.output_json = argsman.GetArg("-output_json", "");
113113
args.regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER);

src/bitcoin-cli.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
702702
// 3. default port for chain
703703
uint16_t port{BaseParams().RPCPort()};
704704
SplitHostPort(gArgs.GetArg("-rpcconnect", DEFAULT_RPCCONNECT), port, host);
705-
port = static_cast<uint16_t>(gArgs.GetArg("-rpcport", port));
705+
port = static_cast<uint16_t>(gArgs.GetIntArg("-rpcport", port));
706706

707707
// Obtain event base
708708
raii_event_base base = obtain_event_base();
@@ -712,7 +712,7 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
712712

713713
// Set connection timeout
714714
{
715-
const int timeout = gArgs.GetArg("-rpcclienttimeout", DEFAULT_HTTP_CLIENT_TIMEOUT);
715+
const int timeout = gArgs.GetIntArg("-rpcclienttimeout", DEFAULT_HTTP_CLIENT_TIMEOUT);
716716
if (timeout > 0) {
717717
evhttp_connection_set_timeout(evcon.get(), timeout);
718718
} else {
@@ -822,7 +822,7 @@ static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& str
822822
UniValue response(UniValue::VOBJ);
823823
// Execute and handle connection failures with -rpcwait.
824824
const bool fWait = gArgs.GetBoolArg("-rpcwait", false);
825-
const int timeout = gArgs.GetArg("-rpcwaittimeout", DEFAULT_WAIT_CLIENT_TIMEOUT);
825+
const int timeout = gArgs.GetIntArg("-rpcwaittimeout", DEFAULT_WAIT_CLIENT_TIMEOUT);
826826
const auto deadline{GetTime<std::chrono::microseconds>() + 1s * timeout};
827827

828828
do {

src/httpserver.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ static bool ThreadHTTP(struct event_base* base)
289289
/** Bind HTTP server to specified addresses */
290290
static bool HTTPBindAddresses(struct evhttp* http)
291291
{
292-
uint16_t http_port{static_cast<uint16_t>(gArgs.GetArg("-rpcport", BaseParams().RPCPort()))};
292+
uint16_t http_port{static_cast<uint16_t>(gArgs.GetIntArg("-rpcport", BaseParams().RPCPort()))};
293293
std::vector<std::pair<std::string, uint16_t>> endpoints;
294294

295295
// Determine what addresses to bind to
@@ -374,7 +374,7 @@ bool InitHTTPServer()
374374
return false;
375375
}
376376

377-
evhttp_set_timeout(http, gArgs.GetArg("-rpcservertimeout", DEFAULT_HTTP_SERVER_TIMEOUT));
377+
evhttp_set_timeout(http, gArgs.GetIntArg("-rpcservertimeout", DEFAULT_HTTP_SERVER_TIMEOUT));
378378
evhttp_set_max_headers_size(http, MAX_HEADERS_SIZE);
379379
evhttp_set_max_body_size(http, MAX_SIZE);
380380
evhttp_set_gencb(http, http_request_cb, nullptr);
@@ -385,7 +385,7 @@ bool InitHTTPServer()
385385
}
386386

387387
LogPrint(BCLog::HTTP, "Initialized HTTP server\n");
388-
int workQueueDepth = std::max((long)gArgs.GetArg("-rpcworkqueue", DEFAULT_HTTP_WORKQUEUE), 1L);
388+
int workQueueDepth = std::max((long)gArgs.GetIntArg("-rpcworkqueue", DEFAULT_HTTP_WORKQUEUE), 1L);
389389
LogPrintf("HTTP: creating work queue of depth %d\n", workQueueDepth);
390390

391391
g_work_queue = std::make_unique<WorkQueue<HTTPClosure>>(workQueueDepth);
@@ -415,7 +415,7 @@ static std::vector<std::thread> g_thread_http_workers;
415415
void StartHTTPServer()
416416
{
417417
LogPrint(BCLog::HTTP, "Starting HTTP server\n");
418-
int rpcThreads = std::max((long)gArgs.GetArg("-rpcthreads", DEFAULT_HTTP_THREADS), 1L);
418+
int rpcThreads = std::max((long)gArgs.GetIntArg("-rpcthreads", DEFAULT_HTTP_THREADS), 1L);
419419
LogPrintf("HTTP: starting %d worker threads\n", rpcThreads);
420420
g_thread_http = std::thread(ThreadHTTP, eventBase);
421421

src/init.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
843843
}
844844

845845
// if using block pruning, then disallow txindex and coinstatsindex
846-
if (args.GetArg("-prune", 0)) {
846+
if (args.GetIntArg("-prune", 0)) {
847847
if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX))
848848
return InitError(_("Prune mode is incompatible with -txindex."));
849849
if (args.GetBoolArg("-coinstatsindex", DEFAULT_COINSTATSINDEX))
@@ -868,7 +868,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
868868

869869
// Make sure enough file descriptors are available
870870
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);
872872
nMaxConnections = std::max(nUserMaxConnections, 0);
873873

874874
nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS + MAX_ADDNODE_CONNECTIONS + nBind + NUM_FDS_MESSAGE_CAPTURE);
@@ -913,8 +913,8 @@ bool AppInitParameterInteraction(const ArgsManager& args)
913913
}
914914

915915
// 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;
918918
if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin)
919919
return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(nMempoolSizeMin / 1000000.0)));
920920
// 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)
928928
}
929929

930930
// 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);
932932
if (nPruneArg < 0) {
933933
return InitError(_("Prune cannot be configured with a negative value."));
934934
}
@@ -945,12 +945,12 @@ bool AppInitParameterInteraction(const ArgsManager& args)
945945
fPruneMode = true;
946946
}
947947

948-
nConnectTimeout = args.GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT);
948+
nConnectTimeout = args.GetIntArg("-timeout", DEFAULT_CONNECT_TIMEOUT);
949949
if (nConnectTimeout <= 0) {
950950
nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
951951
}
952952

953-
peer_connect_timeout = args.GetArg("-peertimeout", DEFAULT_PEER_CONNECT_TIMEOUT);
953+
peer_connect_timeout = args.GetIntArg("-peertimeout", DEFAULT_PEER_CONNECT_TIMEOUT);
954954
if (peer_connect_timeout <= 0) {
955955
return InitError(Untranslated("peertimeout cannot be configured with a negative value."));
956956
}
@@ -990,27 +990,27 @@ bool AppInitParameterInteraction(const ArgsManager& args)
990990
if (!chainparams.IsTestChain() && !fRequireStandard) {
991991
return InitError(strprintf(Untranslated("acceptnonstdtxn is not currently supported for %s chain"), chainparams.NetworkIDString()));
992992
}
993-
nBytesPerSigOp = args.GetArg("-bytespersigop", nBytesPerSigOp);
993+
nBytesPerSigOp = args.GetIntArg("-bytespersigop", nBytesPerSigOp);
994994

995995
if (!g_wallet_init_interface.ParameterInteraction()) return false;
996996

997997
fIsBareMultisigStd = args.GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
998998
fAcceptDatacarrier = args.GetBoolArg("-datacarrier", DEFAULT_ACCEPT_DATACARRIER);
999-
nMaxDatacarrierBytes = args.GetArg("-datacarriersize", nMaxDatacarrierBytes);
999+
nMaxDatacarrierBytes = args.GetIntArg("-datacarriersize", nMaxDatacarrierBytes);
10001000

10011001
// 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
10031003

10041004
if (args.GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS))
10051005
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);
10061006

1007-
if (args.GetArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) < 0)
1007+
if (args.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) < 0)
10081008
return InitError(Untranslated("rpcserialversion must be non-negative."));
10091009

1010-
if (args.GetArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) > 1)
1010+
if (args.GetIntArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) > 1)
10111011
return InitError(Untranslated("Unknown rpcserialversion requested."));
10121012

1013-
nMaxTipAge = args.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
1013+
nMaxTipAge = args.GetIntArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
10141014

10151015
if (args.IsArgSet("-proxy") && args.GetArg("-proxy", "").empty()) {
10161016
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)
10991099
InitSignatureCache();
11001100
InitScriptExecutionCache();
11011101

1102-
int script_threads = args.GetArg("-par", DEFAULT_SCRIPTCHECK_THREADS);
1102+
int script_threads = args.GetIntArg("-par", DEFAULT_SCRIPTCHECK_THREADS);
11031103
if (script_threads <= 0) {
11041104
// -par=0 means autodetect (number of cores - 1 script threads)
11051105
// -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)
12061206
}
12071207

12081208
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));
12101210
assert(!node.connman);
12111211
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));
12121212

@@ -1216,7 +1216,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
12161216
if (!ignores_incoming_txs) node.fee_estimator = std::make_unique<CBlockPolicyEstimator>();
12171217

12181218
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);
12201220
node.mempool = std::make_unique<CTxMemPool>(node.fee_estimator.get(), check_ratio);
12211221

12221222
assert(!node.chainman);
@@ -1323,7 +1323,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
13231323
bool fReindexChainState = args.GetBoolArg("-reindex-chainstate", false);
13241324

13251325
// cache size calculations
1326-
int64_t nTotalCache = (args.GetArg("-dbcache", nDefaultDbCache) << 20);
1326+
int64_t nTotalCache = (args.GetIntArg("-dbcache", nDefaultDbCache) << 20);
13271327
nTotalCache = std::max(nTotalCache, nMinDbCache << 20); // total cache cannot be less than nMinDbCache
13281328
nTotalCache = std::min(nTotalCache, nMaxDbCache << 20); // total cache cannot be greater than nMaxDbcache
13291329
int64_t nBlockTreeDBCache = std::min(nTotalCache / 8, nMaxBlockDBCache << 20);
@@ -1341,7 +1341,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
13411341
nCoinDBCache = std::min(nCoinDBCache, nMaxCoinsDBCache << 20); // cap total coins db cache
13421342
nTotalCache -= nCoinDBCache;
13431343
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;
13451345
LogPrintf("Cache configuration:\n");
13461346
LogPrintf("* Using %.1f MiB for block index database\n", nBlockTreeDBCache * (1.0 / 1024 / 1024));
13471347
if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX)) {
@@ -1497,7 +1497,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
14971497
for (CChainState* chainstate : chainman.GetAll()) {
14981498
if (!is_coinsview_empty(chainstate)) {
14991499
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) {
15011501
LogPrintf("Prune: pruned datadir may not have more than %d blocks; only checking available blocks\n",
15021502
MIN_BLOCKS_TO_KEEP);
15031503
}
@@ -1514,8 +1514,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
15141514

15151515
if (!CVerifyDB().VerifyDB(
15161516
*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))) {
15191519
strLoadError = _("Corrupted block database detected");
15201520
failed_verification = true;
15211521
break;
@@ -1707,11 +1707,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
17071707
connOptions.uiInterface = &uiInterface;
17081708
connOptions.m_banman = node.banman.get();
17091709
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);
17121712
connOptions.m_added_nodes = args.GetArgs("-addnode");
17131713

1714-
connOptions.nMaxOutboundLimit = 1024 * 1024 * args.GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET);
1714+
connOptions.nMaxOutboundLimit = 1024 * 1024 * args.GetIntArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET);
17151715
connOptions.m_peer_connect_timeout = peer_connect_timeout;
17161716

17171717
for (const std::string& bind_arg : args.GetArgs("-bind")) {

src/miner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static BlockAssembler::Options DefaultOptions()
7272
// Block resource limits
7373
// If -blockmaxweight is not given, limit to DEFAULT_BLOCK_MAX_WEIGHT
7474
BlockAssembler::Options options;
75-
options.nBlockMaxWeight = gArgs.GetArg("-blockmaxweight", DEFAULT_BLOCK_MAX_WEIGHT);
75+
options.nBlockMaxWeight = gArgs.GetIntArg("-blockmaxweight", DEFAULT_BLOCK_MAX_WEIGHT);
7676
if (gArgs.IsArgSet("-blockmintxfee")) {
7777
std::optional<CAmount> parsed = ParseMoney(gArgs.GetArg("-blockmintxfee", ""));
7878
options.blockMinFeeRate = CFeeRate{parsed.value_or(DEFAULT_BLOCK_MIN_TX_FEE)};
@@ -125,7 +125,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
125125
// -regtest only: allow overriding block.nVersion with
126126
// -blockversion=N to test forking scenarios
127127
if (chainparams.MineBlocksOnDemand())
128-
pblock->nVersion = gArgs.GetArg("-blockversion", pblock->nVersion);
128+
pblock->nVersion = gArgs.GetIntArg("-blockversion", pblock->nVersion);
129129

130130
pblock->nTime = GetAdjustedTime();
131131
const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast();

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void CConnman::AddAddrFetch(const std::string& strDest)
123123

124124
uint16_t GetListenPort()
125125
{
126-
return static_cast<uint16_t>(gArgs.GetArg("-port", Params().GetDefaultPort()));
126+
return static_cast<uint16_t>(gArgs.GetIntArg("-port", Params().GetDefaultPort()));
127127
}
128128

129129
// find 'best' local address for a particular peer

src/net_processing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) c
13001300

13011301
void PeerManagerImpl::AddToCompactExtraTransactions(const CTransactionRef& tx)
13021302
{
1303-
size_t max_extra_txn = gArgs.GetArg("-blockreconstructionextratxn", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN);
1303+
size_t max_extra_txn = gArgs.GetIntArg("-blockreconstructionextratxn", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN);
13041304
if (max_extra_txn <= 0)
13051305
return;
13061306
if (!vExtraTxnForCompact.size())
@@ -3315,7 +3315,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
33153315
m_txrequest.ForgetTxHash(tx.GetWitnessHash());
33163316

33173317
// DoS prevention: do not allow m_orphanage to grow unbounded (see CVE-2012-3789)
3318-
unsigned int nMaxOrphanTx = (unsigned int)std::max((int64_t)0, gArgs.GetArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
3318+
unsigned int nMaxOrphanTx = (unsigned int)std::max((int64_t)0, gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
33193319
unsigned int nEvicted = m_orphanage.LimitOrphans(nMaxOrphanTx);
33203320
if (nEvicted > 0) {
33213321
LogPrint(BCLog::MEMPOOL, "orphanage overflow, removed %u tx\n", nEvicted);
@@ -4416,7 +4416,7 @@ void PeerManagerImpl::MaybeSendFeefilter(CNode& pto, std::chrono::microseconds c
44164416
// peers with the forcerelay permission should not filter txs to us
44174417
if (pto.HasPermission(NetPermissionFlags::ForceRelay)) return;
44184418

4419-
CAmount currentFilter = m_mempool.GetMinFee(gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
4419+
CAmount currentFilter = m_mempool.GetMinFee(gArgs.GetIntArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
44204420
static FeeFilterRounder g_filter_rounder{CFeeRate{DEFAULT_MIN_RELAY_TX_FEE}};
44214421

44224422
if (m_chainman.ActiveChainstate().IsInitialBlockDownload()) {

0 commit comments

Comments
 (0)