From 24bc46c83b39149f4845a575a82337eb46d91bdb Mon Sep 17 00:00:00 2001 From: tdb3 <106488469+tdb3@users.noreply.github.com> Date: Sat, 27 Apr 2024 18:10:57 -0400 Subject: [PATCH] cli: Add warning for duplicate port definition Adds a warning when both -rpcconnect and -rpcport define a port to be used. --- src/bitcoin-cli.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index eb1ee6134a..6352044ba7 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -770,6 +770,12 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co // Use the valid port provided port = rpcport_int; + + // If there was a valid port provided in rpcconnect, + // rpcconnect_port is non-zero. + if (rpcconnect_port != 0) { + tfm::format(std::cerr, "Warning: Port specified in both -rpcconnect and -rpcport. Using -rpcport %u\n", port); + } } }