Merge bitcoin/bitcoin#32810: [29.x] More backports

ef2a013e31 doc: update release notes for 29.x (fanquake)
4b656e2023 test: Add msgtype to msg_generic slots (dergoegge)
1c0e19b93a node: cap -dbcache to 1GiB on 32-bit architectures (Antoine Poinsot)
eafea2393d init: cap -maxmempool to 500 MB on 32-bit systems (Antoine Poinsot)
a3c1939d6e cmake: Explicitly specify `Boost_ROOT` for Homebrew's package (Hennadii Stepanov)
a990c1002b cmake: Use `HINTS` instead of `PATHS` in `find_*` commands (Hennadii Stepanov)
5987c1b6ab test: fix catchup loop in outbound eviction functional test (Sebastian Falbesoner)
e37a70bf71 build: add root dir to CMAKE_PREFIX_PATH (will)

Pull request description:

  Backports:
  * #32530
  * #32742
  * #32798
  * #32805
  * #32814
  * #32833

  Fixes #31009.

ACKs for top commit:
  pinheadmz:
    ACK ef2a013e31
  hebasto:
    re-ACK ef2a013e31.
  willcl-ark:
    ACK ef2a013e31

Tree-SHA512: 936ccf732f9fa49acc90de8af0ebf7134aa54dbaf9533c8dfbe08cd178b87a3a091c837d5bb84d61869a69c3c7d499a565b33237b14330a6c66d9c8456d5a261
This commit is contained in:
merge-script
2025-07-03 11:57:31 +01:00
8 changed files with 61 additions and 7 deletions

View File

@@ -17,6 +17,18 @@ function(add_boost_if_needed)
directory and other added INTERFACE properties. directory and other added INTERFACE properties.
]=] ]=]
if(CMAKE_HOST_APPLE)
find_program(HOMEBREW_EXECUTABLE brew)
if(HOMEBREW_EXECUTABLE)
execute_process(
COMMAND ${HOMEBREW_EXECUTABLE} --prefix boost
OUTPUT_VARIABLE Boost_ROOT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
endif()
# We cannot rely on find_package(Boost ...) to work properly without # We cannot rely on find_package(Boost ...) to work properly without
# Boost_NO_BOOST_CMAKE set until we require a more recent Boost because # Boost_NO_BOOST_CMAKE set until we require a more recent Boost because
# upstream did not ship proper CMake files until 1.82.0. # upstream did not ship proper CMake files until 1.82.0.

View File

@@ -21,16 +21,16 @@ endif()
find_path(QRencode_INCLUDE_DIR find_path(QRencode_INCLUDE_DIR
NAMES qrencode.h NAMES qrencode.h
PATHS ${PC_QRencode_INCLUDE_DIRS} HINTS ${PC_QRencode_INCLUDE_DIRS}
) )
find_library(QRencode_LIBRARY_RELEASE find_library(QRencode_LIBRARY_RELEASE
NAMES qrencode NAMES qrencode
PATHS ${PC_QRencode_LIBRARY_DIRS} HINTS ${PC_QRencode_LIBRARY_DIRS}
) )
find_library(QRencode_LIBRARY_DEBUG find_library(QRencode_LIBRARY_DEBUG
NAMES qrencoded qrencode NAMES qrencoded qrencode
PATHS ${PC_QRencode_LIBRARY_DIRS} HINTS ${PC_QRencode_LIBRARY_DIRS}
) )
include(SelectLibraryConfigurations) include(SelectLibraryConfigurations)
select_library_configurations(QRencode) select_library_configurations(QRencode)

View File

@@ -92,6 +92,22 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(QT_TRANSLATIONS_DIR "${CMAKE_CURRENT_LIST_DIR}/translations") set(QT_TRANSLATIONS_DIR "${CMAKE_CURRENT_LIST_DIR}/translations")
# The following is only necessary when using cmake from Nix or NixOS, because
# Nix patches cmake to remove the root directory `/` from
# CMAKE_SYSTEM_PREFIX_PATH. Adding it back is harmless on other platforms and
# necessary on Nix because without it cmake find_path, find_package, etc
# functions do not know where to look in CMAKE_FIND_ROOT_PATH for dependencies
# (https://github.com/bitcoin/bitcoin/issues/32428).
#
# TODO: longer term, it may be possible to use a dependency provider, which
# would bring the find_package calls completely under our control, making this
# patch unnecessary.
#
# Make sure we only append once, as this file may be called repeatedly.
if(NOT "/" IN_LIST CMAKE_PREFIX_PATH)
list(APPEND CMAKE_PREFIX_PATH "/")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE)
# The find_package(Qt ...) function internally uses find_library() # The find_package(Qt ...) function internally uses find_library()
# calls for all dependencies to ensure their availability. # calls for all dependencies to ensure their availability.

View File

@@ -37,6 +37,13 @@ unsupported systems.
Notable changes Notable changes
=============== ===============
### Updated Settings
- The `-maxmempool` and `-dbcache` startup parameters are now capped on
32-bit systems to 500MB and 1GiB respectively.
- #32530 node: cap -maxmempool and -dbcache values for 32-bit
### Wallet ### Wallet
- #31757 wallet: fix crash on double block disconnection - #31757 wallet: fix crash on double block disconnection
@@ -50,6 +57,8 @@ Notable changes
- #32483 test: fix two intermittent failures in wallet_basic.py - #32483 test: fix two intermittent failures in wallet_basic.py
- #32630 test: fix sync function in rpc_psbt.py - #32630 test: fix sync function in rpc_psbt.py
- #32765 test: Fix list index out of range error in feature_bip68_sequence.py - #32765 test: Fix list index out of range error in feature_bip68_sequence.py
- #32742 test: fix catchup loop in outbound eviction functional test
- #32833 test: Add msgtype to msg_generic slots
### Util ### Util
@@ -66,6 +75,9 @@ Notable changes
- #32678 guix: warn and abort when SOURCE_DATE_EPOCH is set - #32678 guix: warn and abort when SOURCE_DATE_EPOCH is set
- #32690 depends: fix SHA256SUM command on OpenBSD (use GNU mode output) - #32690 depends: fix SHA256SUM command on OpenBSD (use GNU mode output)
- #32760 depends: capnp 1.2.0 - #32760 depends: capnp 1.2.0
- #32798 build: add root dir to CMAKE_PREFIX_PATH in toolchain
- #32805 cmake: Use HINTS instead of PATHS in find_* commands
- #32814 cmake: Explicitly specify Boost_ROOT for Homebrew's package
### Gui ### Gui
@@ -106,6 +118,7 @@ Thanks to everyone who directly contributed to this release:
- benthecarman - benthecarman
- Brandon Odiwuor - Brandon Odiwuor
- davidgumberg - davidgumberg
- dergoegge
- enirox001 - enirox001
- fanquake - fanquake
- furszy - furszy

View File

@@ -19,6 +19,8 @@
static constexpr size_t MAX_TX_INDEX_CACHE{1024_MiB}; static constexpr size_t MAX_TX_INDEX_CACHE{1024_MiB};
//! Max memory allocated to all block filter index caches combined in bytes. //! Max memory allocated to all block filter index caches combined in bytes.
static constexpr size_t MAX_FILTER_INDEX_CACHE{1024_MiB}; static constexpr size_t MAX_FILTER_INDEX_CACHE{1024_MiB};
//! Maximum dbcache size on 32-bit systems.
static constexpr size_t MAX_32BIT_DBCACHE{1024_MiB};
namespace node { namespace node {
CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes) CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes)
@@ -28,7 +30,8 @@ CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes)
if (std::optional<int64_t> db_cache = args.GetIntArg("-dbcache")) { if (std::optional<int64_t> db_cache = args.GetIntArg("-dbcache")) {
if (*db_cache < 0) db_cache = 0; if (*db_cache < 0) db_cache = 0;
uint64_t db_cache_bytes = SaturatingLeftShift<uint64_t>(*db_cache, 20); uint64_t db_cache_bytes = SaturatingLeftShift<uint64_t>(*db_cache, 20);
total_cache = std::max<size_t>(MIN_DB_CACHE, std::min<uint64_t>(db_cache_bytes, std::numeric_limits<size_t>::max())); constexpr auto max_db_cache{sizeof(void*) == 4 ? MAX_32BIT_DBCACHE : std::numeric_limits<size_t>::max()};
total_cache = std::max<size_t>(MIN_DB_CACHE, std::min<uint64_t>(db_cache_bytes, max_db_cache));
} }
IndexCacheSizes index_sizes; IndexCacheSizes index_sizes;

View File

@@ -25,6 +25,9 @@ using common::AmountErrMsg;
using kernel::MemPoolLimits; using kernel::MemPoolLimits;
using kernel::MemPoolOptions; using kernel::MemPoolOptions;
//! Maximum mempool size on 32-bit systems.
static constexpr int MAX_32BIT_MEMPOOL_MB{500};
namespace { namespace {
void ApplyArgsManOptions(const ArgsManager& argsman, MemPoolLimits& mempool_limits) void ApplyArgsManOptions(const ArgsManager& argsman, MemPoolLimits& mempool_limits)
{ {
@@ -42,7 +45,13 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& argsman, const CChainP
{ {
mempool_opts.check_ratio = argsman.GetIntArg("-checkmempool", mempool_opts.check_ratio); mempool_opts.check_ratio = argsman.GetIntArg("-checkmempool", mempool_opts.check_ratio);
if (auto mb = argsman.GetIntArg("-maxmempool")) mempool_opts.max_size_bytes = *mb * 1'000'000; if (auto mb = argsman.GetIntArg("-maxmempool")) {
constexpr bool is_32bit{sizeof(void*) == 4};
if (is_32bit && *mb > MAX_32BIT_MEMPOOL_MB) {
return util::Error{Untranslated(strprintf("-maxmempool is set to %i but can't be over %i MB on 32-bit systems", *mb, MAX_32BIT_MEMPOOL_MB))};
}
mempool_opts.max_size_bytes = *mb * 1'000'000;
}
if (auto hours = argsman.GetIntArg("-mempoolexpiry")) mempool_opts.expiry = std::chrono::hours{*hours}; if (auto hours = argsman.GetIntArg("-mempoolexpiry")) mempool_opts.expiry = std::chrono::hours{*hours};

View File

@@ -88,6 +88,7 @@ class P2POutEvict(BitcoinTestFramework):
# Generate an additional block so the peers is 2 blocks behind # Generate an additional block so the peers is 2 blocks behind
prev_header = from_hex(CBlockHeader(), node.getblockheader(best_block_hash, False)) prev_header = from_hex(CBlockHeader(), node.getblockheader(best_block_hash, False))
best_block_hash = self.generateblock(node, output="raw(42)", transactions=[])["hash"] best_block_hash = self.generateblock(node, output="raw(42)", transactions=[])["hash"]
tip_header = from_hex(CBlockHeader(), node.getblockheader(best_block_hash, False))
peer.sync_with_ping() peer.sync_with_ping()
# Advance time but not enough to evict the peer # Advance time but not enough to evict the peer
@@ -100,7 +101,7 @@ class P2POutEvict(BitcoinTestFramework):
# Send a header with the previous tip (so we go back to 1 block behind) # Send a header with the previous tip (so we go back to 1 block behind)
peer.send_and_ping(msg_headers([prev_header])) peer.send_and_ping(msg_headers([prev_header]))
prev_prev_hash = tip_header.hash prev_prev_hash = tip_header.hashPrevBlock
self.log.info("Create an outbound connection and take some time to catch up, but do it in time") self.log.info("Create an outbound connection and take some time to catch up, but do it in time")
# Check that if the peer manages to catch up within time, the timeouts are removed (and the peer is not disconnected) # Check that if the peer manages to catch up within time, the timeouts are removed (and the peer is not disconnected)

View File

@@ -1358,7 +1358,7 @@ class msg_block:
# for cases where a user needs tighter control over what is sent over the wire # for cases where a user needs tighter control over what is sent over the wire
# note that the user must supply the name of the msgtype, and the data # note that the user must supply the name of the msgtype, and the data
class msg_generic: class msg_generic:
__slots__ = ("data") __slots__ = ("msgtype", "data")
def __init__(self, msgtype, data=None): def __init__(self, msgtype, data=None):
self.msgtype = msgtype self.msgtype = msgtype