Skip to content

Commit f805933

Browse files
committed
init: set nMaxOutboundLimit connection option directly
DEFAULT_MAX_UPLOAD_TARGET is a compile time constant.
1 parent 173d0d3 commit f805933

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/init.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,11 +1513,6 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
15131513
RegisterValidationInterface(g_zmq_notification_interface);
15141514
}
15151515
#endif
1516-
uint64_t nMaxOutboundLimit = 0; //unlimited unless -maxuploadtarget is set
1517-
1518-
if (args.IsArgSet("-maxuploadtarget")) {
1519-
nMaxOutboundLimit = args.GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET) * 1024 * 1024;
1520-
}
15211516

15221517
// ********************************************************* Step 7: load block chain
15231518

@@ -1920,7 +1915,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
19201915
connOptions.nReceiveFloodSize = 1000 * args.GetArg("-maxreceivebuffer", DEFAULT_MAXRECEIVEBUFFER);
19211916
connOptions.m_added_nodes = args.GetArgs("-addnode");
19221917

1923-
connOptions.nMaxOutboundLimit = nMaxOutboundLimit;
1918+
connOptions.nMaxOutboundLimit = 1024 * 1024 * args.GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET);
19241919
connOptions.m_peer_connect_timeout = peer_connect_timeout;
19251920

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

src/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static const bool DEFAULT_UPNP = false;
7575
/** The maximum number of peer connections to maintain. */
7676
static const unsigned int DEFAULT_MAX_PEER_CONNECTIONS = 125;
7777
/** The default for -maxuploadtarget. 0 = Unlimited */
78-
static const uint64_t DEFAULT_MAX_UPLOAD_TARGET = 0;
78+
static constexpr uint64_t DEFAULT_MAX_UPLOAD_TARGET = 0;
7979
/** Default for blocks only*/
8080
static const bool DEFAULT_BLOCKSONLY = false;
8181
/** -peertimeout default */

0 commit comments

Comments
 (0)