Skip to content

Commit e0ae9c1

Browse files
committed
Merge bitcoin/bitcoin#31011: refactor: move util/pcp and util/netif to common/
fd38711 ci: make CI job fail when check-deps.sh script fails (Ryan Ofsky) d51edec common: move pcp.cpp and netif.cpp files from util to common library since they depend on netaddress.cpp (Ryan Ofsky) Pull request description: Move util/pcp.cpp and util/netif.cpp to common/ because they depend on netaddress.cpp which is part of the common library. This was causing check-deps.sh script to fail as reported by _fanquake_ in bitcoin/bitcoin#30415 (comment). Also make CI fail when the `check-deps.sh` script fails. Previously it would output errors but not cause the job to fail (which was not intended). ACKs for top commit: Sjors: utACK fd38711 laanwj: Untested ACK fd38711 achow101: ACK fd38711 tdb3: ACK fd38711 Tree-SHA512: 06316e68617ded7d96d540c9934b08cf9fbba5ff5e7f54d7a0c0a9087a26bf8adc97e9e8c39a2bfd3da34e27f3652b1531ec6136a2c69393ae0b26585abadb6b
2 parents 6a37043 + fd38711 commit e0ae9c1

File tree

9 files changed

+17
-14
lines changed

9 files changed

+17
-14
lines changed

contrib/devtools/check-deps.sh

+3
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ cd "$BUILD_DIR/src"
194194
extract_symbols "$TEMP_DIR"
195195
if check_libraries "$TEMP_DIR"; then
196196
echo "Success! No unexpected dependencies were detected."
197+
RET=0
197198
else
198199
echo >&2 "Error: Unexpected dependencies were detected. Check previous output."
200+
RET=1
199201
fi
200202
rm -r "$TEMP_DIR"
203+
exit $RET

src/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ add_library(bitcoin_common STATIC EXCLUDE_FROM_ALL
114114
common/init.cpp
115115
common/interfaces.cpp
116116
common/messages.cpp
117+
common/netif.cpp
118+
common/pcp.cpp
117119
common/run_command.cpp
118120
common/settings.cpp
119121
common/signmessage.cpp

src/util/netif.cpp src/common/netif.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <config/bitcoin-config.h> // IWYU pragma: keep
66

7-
#include <util/netif.h>
7+
#include <common/netif.h>
88

99
#include <logging.h>
1010
#include <netbase.h>

src/util/netif.h src/common/netif.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
44

5-
#ifndef BITCOIN_UTIL_NETIF_H
6-
#define BITCOIN_UTIL_NETIF_H
5+
#ifndef BITCOIN_COMMON_NETIF_H
6+
#define BITCOIN_COMMON_NETIF_H
77

88
#include <netaddress.h>
99

@@ -16,4 +16,4 @@ std::optional<CNetAddr> QueryDefaultGateway(Network network);
1616
//! Return all local non-loopback IPv4 and IPv6 network addresses.
1717
std::vector<CNetAddr> GetLocalAddresses();
1818

19-
#endif // BITCOIN_UTIL_NETIF_H
19+
#endif // BITCOIN_COMMON_NETIF_H

src/util/pcp.cpp src/common/pcp.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
44

5-
#include <util/pcp.h>
5+
#include <common/pcp.h>
66

7+
#include <common/netif.h>
78
#include <crypto/common.h>
89
#include <logging.h>
910
#include <netaddress.h>
1011
#include <netbase.h>
1112
#include <random.h>
1213
#include <span.h>
1314
#include <util/check.h>
14-
#include <util/netif.h>
1515
#include <util/readwritefile.h>
1616
#include <util/sock.h>
1717
#include <util/strencodings.h>

src/util/pcp.h src/common/pcp.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
44

5-
#ifndef BITCOIN_UTIL_PCP_H
6-
#define BITCOIN_UTIL_PCP_H
5+
#ifndef BITCOIN_COMMON_PCP_H
6+
#define BITCOIN_COMMON_PCP_H
77

88
#include <netaddress.h>
99

@@ -65,4 +65,4 @@ std::variant<MappingResult, MappingError> NATPMPRequestPortMap(const CNetAddr &g
6565
//! Returns the external_ip:external_port of the mapping if successful, otherwise a MappingError.
6666
std::variant<MappingResult, MappingError> 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));
6767

68-
#endif // BITCOIN_UTIL_PCP_H
68+
#endif // BITCOIN_COMMON_PCP_H

src/mapport.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
#include <mapport.h>
88

99
#include <clientversion.h>
10+
#include <common/netif.h>
11+
#include <common/pcp.h>
1012
#include <common/system.h>
1113
#include <logging.h>
1214
#include <net.h>
1315
#include <netaddress.h>
1416
#include <netbase.h>
1517
#include <random.h>
16-
#include <util/netif.h>
17-
#include <util/pcp.h>
1818
#include <util/thread.h>
1919
#include <util/threadinterrupt.h>
2020

src/net.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <banman.h>
1313
#include <clientversion.h>
1414
#include <common/args.h>
15+
#include <common/netif.h>
1516
#include <compat/compat.h>
1617
#include <consensus/consensus.h>
1718
#include <crypto/sha256.h>
@@ -28,7 +29,6 @@
2829
#include <random.h>
2930
#include <scheduler.h>
3031
#include <util/fs.h>
31-
#include <util/netif.h>
3232
#include <util/sock.h>
3333
#include <util/strencodings.h>
3434
#include <util/thread.h>

src/util/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL
1515
fs_helpers.cpp
1616
hasher.cpp
1717
moneystr.cpp
18-
netif.cpp
19-
pcp.cpp
2018
rbf.cpp
2119
readwritefile.cpp
2220
serfloat.cpp

0 commit comments

Comments
 (0)