mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge 30308cc380 into merged_master (Bitcoin PR bitcoin/bitcoin#20196)
This commit is contained in:
commit
6f90a02548
12 changed files with 454 additions and 27 deletions
14
src/init.cpp
14
src/init.cpp
|
|
@ -1808,8 +1808,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
LogPrintf("nBestHeight = %d\n", chain_active_height);
|
||||
if (node.peerman) node.peerman->SetBestHeight(chain_active_height);
|
||||
|
||||
Discover();
|
||||
|
||||
// Map ports with UPnP or NAT-PMP.
|
||||
StartMapPort(args.GetBoolArg("-upnp", DEFAULT_UPNP), gArgs.GetBoolArg("-natpmp", DEFAULT_NATPMP));
|
||||
|
||||
|
|
@ -1829,6 +1827,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
connOptions.nMaxOutboundLimit = *opt_max_upload;
|
||||
connOptions.m_peer_connect_timeout = peer_connect_timeout;
|
||||
|
||||
// Port to bind to if `-bind=addr` is provided without a `:port` suffix.
|
||||
const uint16_t default_bind_port =
|
||||
static_cast<uint16_t>(args.GetIntArg("-port", Params().GetDefaultPort()));
|
||||
|
||||
const auto BadPortWarning = [](const char* prefix, uint16_t port) {
|
||||
return strprintf(_("%s request to listen on port %u. This port is considered \"bad\" and "
|
||||
"thus it is unlikely that any Bitcoin Core peers connect to it. See "
|
||||
|
|
@ -1841,7 +1843,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
CService bind_addr;
|
||||
const size_t index = bind_arg.rfind('=');
|
||||
if (index == std::string::npos) {
|
||||
if (Lookup(bind_arg, bind_addr, GetListenPort(), false)) {
|
||||
if (Lookup(bind_arg, bind_addr, default_bind_port, /*fAllowLookup=*/false)) {
|
||||
connOptions.vBinds.push_back(bind_addr);
|
||||
if (IsBadPort(bind_addr.GetPort())) {
|
||||
InitWarning(BadPortWarning("-bind", bind_addr.GetPort()));
|
||||
|
|
@ -1898,6 +1900,12 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
StartTorControl(onion_service_target);
|
||||
}
|
||||
|
||||
if (connOptions.bind_on_any) {
|
||||
// Only add all IP addresses of the machine if we would be listening on
|
||||
// any address - 0.0.0.0 (IPv4) and :: (IPv6).
|
||||
Discover();
|
||||
}
|
||||
|
||||
for (const auto& net : args.GetArgs("-whitelist")) {
|
||||
NetWhitelistPermissions subnet;
|
||||
bilingual_str error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue