Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ AC_ARG_ENABLE([upnp-default],
[use_upnp_default=$enableval],
[use_upnp_default=no])

AC_ARG_WITH([natpmp],
[AS_HELP_STRING([--with-natpmp],
[enable NAT-PMP (default is yes if libnatpmp is found)])],
[use_natpmp=$withval],
[use_natpmp=auto])

AC_ARG_ENABLE([natpmp-default],
[AS_HELP_STRING([--enable-natpmp-default],
[if NAT-PMP is enabled, turn it on at startup (default is no)])],
[use_natpmp_default=$enableval],
[use_natpmp_default=no])

AC_ARG_ENABLE(tests,
AS_HELP_STRING([--disable-tests],[do not compile tests (default is to compile)]),
[use_tests=$enableval],
Expand Down Expand Up @@ -678,6 +690,33 @@ case $host in
PKG_CONFIG_PATH="$qt5_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH
fi

case $host in
*aarch64*)
dnl The preferred Homebrew prefix for Apple Silicon is /opt/homebrew.
dnl Therefore, as we do not use pkg-config to detect miniupnpc and libnatpmp
dnl packages, we should set the CPPFLAGS and LDFLAGS variables for them
dnl explicitly.
if test "x$use_upnp" != xno && $BREW list --versions miniupnpc >/dev/null; then
miniupnpc_prefix=$($BREW --prefix miniupnpc 2>/dev/null)
if test "x$suppress_external_warnings" != xno; then
CPPFLAGS="$CPPFLAGS -isystem $miniupnpc_prefix/include"
else
CPPFLAGS="$CPPFLAGS -I$miniupnpc_prefix/include"
fi
LDFLAGS="$LDFLAGS -L$miniupnpc_prefix/lib"
fi
if test "x$use_natpmp" != xno && $BREW list --versions libnatpmp >/dev/null; then
libnatpmp_prefix=$($BREW --prefix libnatpmp 2>/dev/null)
if test "x$suppress_external_warnings" != xno; then
CPPFLAGS="$CPPFLAGS -isystem $libnatpmp_prefix/include"
else
CPPFLAGS="$CPPFLAGS -I$libnatpmp_prefix/include"
fi
LDFLAGS="$LDFLAGS -L$libnatpmp_prefix/lib"
fi
;;
esac
fi
else
case $build_os in
Expand Down Expand Up @@ -1182,6 +1221,7 @@ if test "x$enable_fuzz" = "xyes"; then
use_bench=no
use_openssl=no
use_upnp=no
use_natpmp=no
use_zmq=no
else
BITCOIN_QT_INIT
Expand Down Expand Up @@ -1235,6 +1275,13 @@ if test x$have_miniupnpc != xno; then
fi
fi

dnl Check for libnatpmp (optional).
if test "x$use_natpmp" != xno; then
AC_CHECK_HEADERS([natpmp.h],
[AC_CHECK_LIB([natpmp], [initnatpmp], [NATPMP_LIBS=-lnatpmp], [have_natpmp=no])],
[have_natpmp=no])
fi

if test x$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnonononononono; then
use_boost=no
else
Expand Down Expand Up @@ -1597,6 +1644,34 @@ else
fi
fi

dnl Enable NAT-PMP support.
AC_MSG_CHECKING([whether to build with support for NAT-PMP])
if test "x$have_natpmp" = xno; then
if test "x$use_natpmp" = xyes; then
AC_MSG_ERROR([NAT-PMP requested but cannot be built. Use --without-natpmp])
fi
AC_MSG_RESULT([no])
use_natpmp=no
else
if test "x$use_natpmp" != xno; then
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([whether to build with NAT-PMP enabled by default])
use_natpmp=yes
natpmp_setting=0
if test "x$use_natpmp_default" != xno; then
use_natpmp_default=yes
natpmp_setting=1
fi
AC_MSG_RESULT($use_natpmp_default)
AC_DEFINE_UNQUOTED([USE_NATPMP], [$natpmp_setting], [NAT-PMP support not compiled if undefined, otherwise value (0 or 1) determines default state])
if test x$TARGET_OS = xwindows; then
NATPMP_CPPFLAGS="-DSTATICLIB -DNATPMP_STATICLIB"
fi
else
AC_MSG_RESULT([no])
fi
fi

dnl these are only used when qt is enabled
BUILD_TEST_QT=""
if test x$bitcoin_enable_qt != xno; then
Expand Down Expand Up @@ -1773,6 +1848,8 @@ AC_SUBST(MINIUPNPC_LIBS)
AC_SUBST(CRYPTO_LIBS)
AC_SUBST(SSL_LIBS)
AC_SUBST(GMP_LIBS)
AC_SUBST(NATPMP_CPPFLAGS)
AC_SUBST(NATPMP_LIBS)
AC_SUBST(EVENT_LIBS)
AC_SUBST(EVENT_PTHREADS_LIBS)
AC_SUBST(ZMQ_LIBS)
Expand Down Expand Up @@ -1851,6 +1928,7 @@ if test x$use_tests != xno; then
echo " with fuzz = $enable_fuzz"
fi
echo " with upnp = $use_upnp"
echo " with natpmp = $use_natpmp"
echo " use asm = $use_asm"
echo " sanitizers = $use_sanitizers"
echo " debug enabled = $enable_debug"
Expand Down
6 changes: 5 additions & 1 deletion depends/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ NO_OPENSSL ?=
NO_WALLET ?=
NO_ZMQ ?=
NO_UPNP ?=
NO_NATPMP ?=
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources

BUILD = $(shell ./config.guess)
Expand Down Expand Up @@ -134,12 +135,14 @@ endif
qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages)
wallet_packages_$(NO_WALLET) = $(wallet_packages)
upnp_packages_$(NO_UPNP) = $(upnp_packages)
natpmp_packages_$(NO_NATPMP) = $(natpmp_packages)

zmq_packages_$(NO_ZMQ) = $(zmq_packages)

protobuf_packages_$(NO_PROTOBUF) = $(protobuf_packages)
openssl_packages_$(NO_OPENSSL) = $(openssl_packages)

packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_)
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) $(natpmp_packages_)
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)

ifneq ($(protobuf_packages_),)
Expand Down Expand Up @@ -218,6 +221,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
-e 's|@disable_bip70@|$(NO_PROTOBUF)|' \
-e 's|@no_wallet@|$(NO_WALLET)|' \
-e 's|@no_upnp@|$(NO_UPNP)|' \
-e 's|@no_natpmp@|$(NO_NATPMP)|' \
-e 's|@debug@|$(DEBUG)|' \
$< > $@
$(AT)touch $@
Expand Down
2 changes: 2 additions & 0 deletions depends/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ The following can be set when running make: `make FOO=bar`
<dd>Don't download/build/cache libs needed to enable the wallet</dd>
<dt>NO_UPNP</dt>
<dd>Don't download/build/cache packages needed for enabling upnp</dd>
<dt>NO_NATPMP</dt>
<dd>Don't download/build/cache packages needed for enabling NAT-PMP</dd>
<dt>DEBUG</dt>
<dd>disable some optimizations and enable more runtime checking</dd>
<dt>PROTOBUF</dt>
Expand Down
4 changes: 4 additions & 0 deletions depends/config.site.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ if test -z $with_miniupnpc && test -n "@no_upnp@"; then
with_miniupnpc=no
fi

if test -z $with_natpmp && test -n "@no_natpmp@"; then
with_natpmp=no
fi

if test -z $with_gui && test -n "@no_qt@"; then
with_gui=no
fi
Expand Down
22 changes: 22 additions & 0 deletions depends/packages/libnatpmp.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package=libnatpmp
$(package)_version=4536032ae32268a45c073a4d5e91bbab4534773a
$(package)_download_path=https://github.com/miniupnp/libnatpmp/archive
$(package)_file_name=$($(package)_version).tar.gz
$(package)_sha256_hash=543b460aab26acf91e11d15e17d8798f845304199eea2d76c2f444ec749c5383

define $(package)_set_vars
$(package)_build_opts=CC="$($(package)_cc)"
$(package)_build_opts_mingw32=CPPFLAGS=-DNATPMP_STATICLIB
$(package)_build_opts_darwin=LIBTOOL="$($(package)_libtool)"
$(package)_build_env+=CFLAGS="$($(package)_cflags) $($(package)_cppflags)" AR="$($(package)_ar)"
endef

define $(package)_build_cmds
$(MAKE) libnatpmp.a $($(package)_build_opts)
endef

define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/include $($(package)_staging_prefix_dir)/lib &&\
install *.h $($(package)_staging_prefix_dir)/include &&\
install libnatpmp.a $($(package)_staging_prefix_dir)/lib
endef
1 change: 1 addition & 0 deletions depends/packages/packages.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ wallet_packages=bdb
zmq_packages=zeromq

upnp_packages=miniupnpc
natpmp_packages=libnatpmp

darwin_native_packages = native_biplist native_ds_store native_mac_alias

Expand Down
2 changes: 1 addition & 1 deletion doc/build-osx.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Base build dependencies
-----------------------

```bash
brew install automake libtool pkg-config
brew install automake libtool pkg-config libnatpmp
```

If you want to build the disk image with `make deploy` (.dmg / optional), you need RSVG:
Expand Down
1 change: 1 addition & 0 deletions doc/productivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ After running `./autogen.sh`, which generates the `./configure` file, use `./con

```sh
--without-miniupnpc
--without-natpmp
--disable-bench
--disable-wallet
--without-gui
Expand Down
2 changes: 1 addition & 1 deletion doc/tor.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ as well, use `discover` instead:

./dashd ... -discover

and open port 9999 on your firewall (or use -upnp).
and open port 9999 on your firewall (or use port mapping, i.e., `-upnp` or `-natpmp`).

If you only want to use Tor to reach .onion addresses, but not use it as a proxy
for normal IPv4/IPv6 communication, use:
Expand Down
10 changes: 6 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ BITCOIN_CORE_H = \
llmq/params.h \
logging.h \
logging/timer.h \
mapport.h \
masternode/node.h \
masternode/meta.h \
masternode/payments.h \
Expand Down Expand Up @@ -340,7 +341,7 @@ libdash_util_a-clientversion.$(OBJEXT): obj/build.h
# Contains code accessing mempool and chain state that is meant to be separated
# from wallet and gui code (see node/README.md). Shared code should go in
# libdash_common or libdash_util libraries, instead.
libdash_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
libdash_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(NATPMP_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
libdash_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libdash_server_a_SOURCES = \
addrdb.cpp \
Expand All @@ -354,6 +355,7 @@ libdash_server_a_SOURCES = \
coinjoin/options.cpp \
coinjoin/server.cpp \
consensus/tx_verify.cpp \
dbwrapper.cpp \
dsnotificationinterface.cpp \
evo/cbtx.cpp \
evo/deterministicmns.cpp \
Expand All @@ -373,7 +375,6 @@ libdash_server_a_SOURCES = \
interfaces/chain.cpp \
interfaces/node.cpp \
init.cpp \
dbwrapper.cpp \
governance/governance.cpp \
governance/classes.cpp \
governance/object.cpp \
Expand All @@ -393,6 +394,7 @@ libdash_server_a_SOURCES = \
llmq/signing.cpp \
llmq/signing_shares.cpp \
llmq/utils.cpp \
mapport.cpp \
masternode/node.cpp \
masternode/meta.cpp \
masternode/payments.cpp \
Expand Down Expand Up @@ -734,7 +736,7 @@ dashd_LDADD = \
$(LIBMEMENV) \
$(LIBSECP256K1)

dashd_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS) $(BLS_LIBS) $(GMP_LIBS)
dashd_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS) $(BLS_LIBS) $(GMP_LIBS)

# dash-cli binary #
dash_cli_SOURCES = dash-cli.cpp
Expand Down Expand Up @@ -803,7 +805,7 @@ dash_wallet_LDADD = \
$(LIBSECP256K1) \
$(LIBUNIVALUE)

dash_wallet_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(MINIUPNPC_LIBS) $(ZMQ_LIBS) $(BLS_LIBS) $(GMP_LIBS)
dash_wallet_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(ZMQ_LIBS) $(BLS_LIBS) $(GMP_LIBS)
#

# dashconsensus library #
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.bench.include
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ bench_bench_dash_SOURCES += bench/coin_selection.cpp
bench_bench_dash_SOURCES += bench/wallet_balance.cpp
endif

bench_bench_dash_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS) $(GMP_LIBS)
bench_bench_dash_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS) $(GMP_LIBS)
bench_bench_dash_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

CLEAN_BITCOIN_BENCH = bench/*.gcda bench/*.gcno $(GENERATED_BENCH_FILES)
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ if ENABLE_ZMQ
qt_dash_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif
qt_dash_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \
$(BACKTRACE_LIB) $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
$(BACKTRACE_LIB) $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(LIBSECP256K1) \
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS) $(GMP_LIBS)
if ENABLE_BIP70
qt_dash_qt_LDADD += $(SSL_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.qttest.include
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ qt_test_test_dash_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif
qt_test_test_dash_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \
$(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BACKTRACE_LIB) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \
$(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
$(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(LIBSECP256K1) \
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS) $(GMP_LIBS)
qt_test_test_dash_qt_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
qt_test_test_dash_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ test_test_dash_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMM
$(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BACKTRACE_LIB) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)
test_test_dash_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)

test_test_dash_LDADD += $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS) $(GMP_LIBS)
test_test_dash_LDADD += $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS) $(GMP_LIBS)
test_test_dash_LDFLAGS = $(LDFLAGS_WRAP_EXCEPTIONS) $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static

if ENABLE_ZMQ
Expand Down
20 changes: 14 additions & 6 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <index/blockfilterindex.h>
#include <index/txindex.h>
#include <key.h>
#include <validation.h>
#include <mapport.h>
#include <miner.h>
#include <netbase.h>
#include <net.h>
Expand Down Expand Up @@ -57,6 +57,7 @@
#include <util/system.h>
#include <util/threadnames.h>
#include <util/validation.h>
#include <validation.h>
#include <validationinterface.h>

#include <masternode/node.h>
Expand Down Expand Up @@ -559,6 +560,11 @@ void SetupServerArgs()
#else
hidden_args.emplace_back("-upnp");
#endif
#ifdef USE_NATPMP
gArgs.AddArg("-natpmp", strprintf("Use NAT-PMP to map the listening port (default: %s)", DEFAULT_NATPMP ? "1 when listening and no -proxy" : "0"), ArgsManager::ALLOW_BOOL, OptionsCategory::CONNECTION);
#else
hidden_args.emplace_back("-natpmp");
#endif // USE_NATPMP
gArgs.AddArg("-whitebind=<[permissions@]addr>", "Bind to given address and whitelist peers connecting to it. "
"Use [host]:port notation for IPv6. Allowed permissions are bloomfilter (allow requesting BIP37 filtered blocks and transactions), "
"noban (do not ban for misbehavior), "
Expand Down Expand Up @@ -1084,10 +1090,12 @@ void InitParameterInteraction()
// to protect privacy, do not listen by default if a default proxy server is specified
if (gArgs.SoftSetBoolArg("-listen", false))
LogPrintf("%s: parameter interaction: -proxy set -> setting -listen=0\n", __func__);
// to protect privacy, do not use UPNP when a proxy is set. The user may still specify -listen=1
// to protect privacy, do not map ports when a proxy is set. The user may still specify -listen=1
// to listen locally, so don't rely on this happening through -listen below.
if (gArgs.SoftSetBoolArg("-upnp", false))
LogPrintf("%s: parameter interaction: -proxy set -> setting -upnp=0\n", __func__);
if (gArgs.SoftSetBoolArg("-natpmp", false))
LogPrintf("%s: parameter interaction: -proxy set -> setting -natpmp=0\n", __func__);
// to protect privacy, do not discover addresses by default
if (gArgs.SoftSetBoolArg("-discover", false))
LogPrintf("%s: parameter interaction: -proxy set -> setting -discover=0\n", __func__);
Expand All @@ -1097,6 +1105,8 @@ void InitParameterInteraction()
// do not map ports or try to retrieve public IP when not listening (pointless)
if (gArgs.SoftSetBoolArg("-upnp", false))
LogPrintf("%s: parameter interaction: -listen=0 -> setting -upnp=0\n", __func__);
if (gArgs.SoftSetBoolArg("-natpmp", false))
LogPrintf("%s: parameter interaction: -listen=0 -> setting -natpmp=0\n", __func__);
if (gArgs.SoftSetBoolArg("-discover", false))
LogPrintf("%s: parameter interaction: -listen=0 -> setting -discover=0\n", __func__);
if (gArgs.SoftSetBoolArg("-listenonion", false))
Expand Down Expand Up @@ -2411,10 +2421,8 @@ bool AppInitMain(InitInterfaces& interfaces)

Discover();

// Map ports with UPnP
if (gArgs.GetBoolArg("-upnp", DEFAULT_UPNP)) {
StartMapPort();
}
// Map ports with UPnP or NAT-PMP.
StartMapPort(gArgs.GetBoolArg("-upnp", DEFAULT_UPNP), gArgs.GetBoolArg("-natpmp", DEFAULT_NATPMP));

CConnman::Options connOptions;
connOptions.nLocalServices = nLocalServices;
Expand Down
Loading