From d51edecddcb7fa52349c8aa5ef88b01f72be44c7 Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Tue, 1 Oct 2024 09:12:22 -0400 Subject: [PATCH] common: move pcp.cpp and netif.cpp files from util to common library since they depend on netaddress.cpp Prevents check-deps.sh errors reported by fanquake https://github.com/bitcoin/bitcoin/pull/30415#issuecomment-2385475097 --- src/CMakeLists.txt | 2 ++ src/{util => common}/netif.cpp | 2 +- src/{util => common}/netif.h | 6 +++--- src/{util => common}/pcp.cpp | 4 ++-- src/{util => common}/pcp.h | 6 +++--- src/mapport.cpp | 4 ++-- src/net.cpp | 2 +- src/util/CMakeLists.txt | 2 -- 8 files changed, 14 insertions(+), 14 deletions(-) rename src/{util => common}/netif.cpp (99%) rename src/{util => common}/netif.h (86%) rename src/{util => common}/pcp.cpp (99%) rename src/{util => common}/pcp.h (97%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8c81e21f76e..d10638e887d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -114,6 +114,8 @@ add_library(bitcoin_common STATIC EXCLUDE_FROM_ALL common/init.cpp common/interfaces.cpp common/messages.cpp + common/netif.cpp + common/pcp.cpp common/run_command.cpp common/settings.cpp common/signmessage.cpp diff --git a/src/util/netif.cpp b/src/common/netif.cpp similarity index 99% rename from src/util/netif.cpp rename to src/common/netif.cpp index 75d0cf00c51..d75123b2653 100644 --- a/src/util/netif.cpp +++ b/src/common/netif.cpp @@ -4,7 +4,7 @@ #include // IWYU pragma: keep -#include +#include #include #include diff --git a/src/util/netif.h b/src/common/netif.h similarity index 86% rename from src/util/netif.h rename to src/common/netif.h index 5ff473fd4f2..55bc023be68 100644 --- a/src/util/netif.h +++ b/src/common/netif.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or https://www.opensource.org/licenses/mit-license.php. -#ifndef BITCOIN_UTIL_NETIF_H -#define BITCOIN_UTIL_NETIF_H +#ifndef BITCOIN_COMMON_NETIF_H +#define BITCOIN_COMMON_NETIF_H #include @@ -16,4 +16,4 @@ std::optional QueryDefaultGateway(Network network); //! Return all local non-loopback IPv4 and IPv6 network addresses. std::vector GetLocalAddresses(); -#endif // BITCOIN_UTIL_NETIF_H +#endif // BITCOIN_COMMON_NETIF_H diff --git a/src/util/pcp.cpp b/src/common/pcp.cpp similarity index 99% rename from src/util/pcp.cpp rename to src/common/pcp.cpp index b02568db356..3cc1cba9242 100644 --- a/src/util/pcp.cpp +++ b/src/common/pcp.cpp @@ -2,8 +2,9 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or https://www.opensource.org/licenses/mit-license.php. -#include +#include +#include #include #include #include @@ -11,7 +12,6 @@ #include #include #include -#include #include #include #include diff --git a/src/util/pcp.h b/src/common/pcp.h similarity index 97% rename from src/util/pcp.h rename to src/common/pcp.h index 0a7955fa573..ce2273e1405 100644 --- a/src/util/pcp.h +++ b/src/common/pcp.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or https://www.opensource.org/licenses/mit-license.php. -#ifndef BITCOIN_UTIL_PCP_H -#define BITCOIN_UTIL_PCP_H +#ifndef BITCOIN_COMMON_PCP_H +#define BITCOIN_COMMON_PCP_H #include @@ -65,4 +65,4 @@ std::variant NATPMPRequestPortMap(const CNetAddr &g //! Returns the external_ip:external_port of the mapping if successful, otherwise a MappingError. std::variant PCPRequestPortMap(const PCPMappingNonce &nonce, const CNetAddr &gateway, const CNetAddr &bind, uint16_t port, uint32_t lifetime, int num_tries = 3, std::chrono::milliseconds timeout_per_try = std::chrono::milliseconds(1000)); -#endif // BITCOIN_UTIL_PCP_H +#endif // BITCOIN_COMMON_PCP_H diff --git a/src/mapport.cpp b/src/mapport.cpp index fd15708edc8..993dade143c 100644 --- a/src/mapport.cpp +++ b/src/mapport.cpp @@ -7,14 +7,14 @@ #include #include +#include +#include #include #include #include #include #include #include -#include -#include #include #include diff --git a/src/net.cpp b/src/net.cpp index e120aee2c45..3f9918d2b19 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -28,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index f4b9b47d10e..4999dbf13f0 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -15,8 +15,6 @@ add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL fs_helpers.cpp hasher.cpp moneystr.cpp - netif.cpp - pcp.cpp rbf.cpp readwritefile.cpp serfloat.cpp