From 222fbfcc6a02ec5bac367e156392d49fb215c066 Mon Sep 17 00:00:00 2001 From: brunoerg Date: Tue, 1 Jul 2025 11:54:04 -0300 Subject: [PATCH 01/15] test: check P2SH sigop count for coinbase tx Github-Pull: #32850 Rebased-From: d6aaffcb11adcf47480fcc5081af9dcb732decf3 --- src/test/script_p2sh_tests.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/script_p2sh_tests.cpp b/src/test/script_p2sh_tests.cpp index bb408b7b0f5..b46411185cd 100644 --- a/src/test/script_p2sh_tests.cpp +++ b/src/test/script_p2sh_tests.cpp @@ -364,6 +364,12 @@ BOOST_AUTO_TEST_CASE(AreInputsStandard) // 22 P2SH sigops for all inputs (1 for vin[0], 6 for vin[3], 15 for vin[4] BOOST_CHECK_EQUAL(GetP2SHSigOpCount(CTransaction(txTo), coins), 22U); + CMutableTransaction coinbase_tx_mut; + coinbase_tx_mut.vin.resize(1); + CTransaction coinbase_tx{coinbase_tx_mut}; + BOOST_CHECK(coinbase_tx.IsCoinBase()); + BOOST_CHECK_EQUAL(GetP2SHSigOpCount(coinbase_tx, coins), 0U); + CMutableTransaction txToNonStd1; txToNonStd1.vout.resize(1); txToNonStd1.vout[0].scriptPubKey = GetScriptForDestination(PKHash(key[1].GetPubKey())); From f82015ccfc7c719405e942ef31c4b59865ee576a Mon Sep 17 00:00:00 2001 From: pablomartin4btc Date: Fri, 27 Jun 2025 13:41:06 -0300 Subject: [PATCH 02/15] test: Clarify roles in outbound eviction comments Some ambiguous uses of "we" referring to either the node or the peer are replaced with clearer phrasing. Also rephrase some comments for consistency and readability. Applies to all relevant outbound eviction tests in p2p_eviction_logic.py. Github-Pull: #32823 Rebased-From: 26598ed21ea7228c4ecf85da24527c88f9c1f1c1 --- test/functional/p2p_outbound_eviction.py | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/test/functional/p2p_outbound_eviction.py b/test/functional/p2p_outbound_eviction.py index 3d6f154a34a..cb95d49a12c 100755 --- a/test/functional/p2p_outbound_eviction.py +++ b/test/functional/p2p_outbound_eviction.py @@ -55,7 +55,7 @@ class P2POutEvict(BitcoinTestFramework): self.log.info("Test that the peer gets evicted") peer.wait_for_disconnect() - self.log.info("Create an outbound connection and send header but never catch up") + self.log.info("Create an outbound connection and send header but the peer never catches up") # Mimic a node that just falls behind for long enough # This should also apply for a node doing IBD that does not catch up in time # Connect a peer and make it send us headers ending in our tip's parent @@ -75,7 +75,7 @@ class P2POutEvict(BitcoinTestFramework): self.log.info("Create an outbound connection and keep lagging behind, but not too much") # Test that if the peer never catches up with our current tip, but it does with the # expected work that we set when setting the timer (that is, our tip at the time) - # we do not disconnect the peer + # the node does not disconnect the peer peer = node.add_outbound_p2p_connection(P2PInterface(), p2p_idx=0, connection_type="outbound-full-relay") self.log.info("Mine a block so our peer starts lagging") @@ -83,7 +83,7 @@ class P2POutEvict(BitcoinTestFramework): best_block_hash = self.generateblock(node, output="raw(42)", transactions=[])["hash"] peer.sync_with_ping() - self.log.info("Keep catching up with the old tip and check that we are not evicted") + self.log.info("The peer keeps catching up with the old tip; check that the node does not evict the peer") for i in range(10): # Generate an additional block so the peers is 2 blocks behind prev_header = from_hex(CBlockHeader(), node.getblockheader(best_block_hash, False)) @@ -96,21 +96,21 @@ class P2POutEvict(BitcoinTestFramework): node.setmocktime(cur_mock_time) peer.sync_with_ping() - # Wait until we get out last call (by receiving a getheaders) + # Make the peer wait until it gets node's last call (by receiving a getheaders) peer.wait_for_getheaders(block_hash=prev_prev_hash) - # Send a header with the previous tip (so we go back to 1 block behind) + # The peer sends a header with the previous tip (so the peer goes back to 1 block behind) peer.send_and_ping(msg_headers([prev_header])) 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") # Check that if the peer manages to catch up within time, the timeouts are removed (and the peer is not disconnected) - # We are reusing the peer from the previous case which already sent us a valid (but old) block and whose timer is ticking + # We are reusing the peer from the previous case which already sent the node a valid (but old) block and whose timer is ticking - # Send an updated headers message matching our tip + # Make the peer send an updated headers message matching our tip peer.send_and_ping(msg_headers([from_hex(CBlockHeader(), node.getblockheader(best_block_hash, False))])) - # Wait for long enough for the timeouts to have triggered and check that we are still connected + # Wait for long enough for the timeouts to have triggered and check that the peer is still connected cur_mock_time += (CHAIN_SYNC_TIMEOUT + 1) node.setmocktime(cur_mock_time) peer.sync_with_ping() @@ -123,8 +123,10 @@ class P2POutEvict(BitcoinTestFramework): def test_outbound_eviction_protected(self): # This tests the eviction logic for **protected** outbound peers (that is, PeerManagerImpl::ConsiderEviction) - # Outbound connections are flagged as protected as long as they have sent us a connecting block with at least as - # much work as our current tip and we have enough empty protected_peers slots. + # Outbound connections are flagged as protected if: + # - The peer sends a connecting block with at least as much work as our current tip. + # - There are still available slots in the node's protected_peers list. + # This test ensures that such protected outbound peers are not disconnected even after chain sync and headers timeouts. node = self.nodes[0] cur_mock_time = node.mocktime tip_header = from_hex(CBlockHeader(), node.getblockheader(node.getbestblockhash(), False)) @@ -145,7 +147,7 @@ class P2POutEvict(BitcoinTestFramework): peer.wait_for_getheaders(block_hash=tip_header.hashPrevBlock) cur_mock_time += (HEADERS_RESPONSE_TIME + 1) node.setmocktime(cur_mock_time) - self.log.info("Test that the node does not get evicted") + self.log.info("Test that the peer does not get evicted") peer.sync_with_ping() node.disconnect_p2ps() @@ -205,7 +207,7 @@ class P2POutEvict(BitcoinTestFramework): cur_mock_time += (HEADERS_RESPONSE_TIME + 1) node.setmocktime(cur_mock_time) - self.log.info("Check how none of the honest nor protected peers was evicted but all the misbehaving unprotected were") + self.log.info("Check that none of the honest or protected peers were evicted, but all misbehaving unprotected peers were") for peer in protected_peers + honest_unprotected_peers: peer.sync_with_ping() for peer in misbehaving_unprotected_peers: From 3a57bfaaf9b0712ff080bd8a315c01552735b882 Mon Sep 17 00:00:00 2001 From: pablomartin4btc Date: Fri, 27 Jun 2025 13:46:42 -0300 Subject: [PATCH 03/15] test: Use rehash() in outbound eviction block-relay Ensure that tip_header.rehash() is used instead of tip_header.hash, which is None when the header is deserialized from hex. This avoids depending on wait_for_getheaders() falling back to any received message, making the test more explicit and robust. Github-Pull: #32823 Rebased-From: ec004cdb86e6471915e1033f390c76ee0428e415 --- test/functional/p2p_outbound_eviction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/p2p_outbound_eviction.py b/test/functional/p2p_outbound_eviction.py index cb95d49a12c..43458decbc9 100755 --- a/test/functional/p2p_outbound_eviction.py +++ b/test/functional/p2p_outbound_eviction.py @@ -235,7 +235,7 @@ class P2POutEvict(BitcoinTestFramework): cur_mock_time += (CHAIN_SYNC_TIMEOUT + 1) node.setmocktime(cur_mock_time) peer.sync_with_ping() - peer.wait_for_getheaders(block_hash=tip_header.hash) + peer.wait_for_getheaders(block_hash=tip_header.rehash()) cur_mock_time += (HEADERS_RESPONSE_TIME + 1) node.setmocktime(cur_mock_time) self.log.info("Test that the peer gets evicted") From 8a4a938db527636aadaa874d733542613b3d14b6 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:59:46 +0100 Subject: [PATCH 04/15] depends: Override host compilers for FreeBSD and OpenBSD When building depends on FreeBSD/OpenBSD `aarch64`, the host compilers default to `default_host_{CC,CXX}`, which resolves to `gcc`/`g++`. This is incorrect on these systems, where Clang is the default system compiler. Github-Pull: #32716 Rebased-From: 4f10a57671c19cacca630b2401e42a213aacff1b --- depends/builders/freebsd.mk | 4 ++++ depends/builders/openbsd.mk | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/depends/builders/freebsd.mk b/depends/builders/freebsd.mk index 18316f492ee..910de28bf36 100644 --- a/depends/builders/freebsd.mk +++ b/depends/builders/freebsd.mk @@ -3,3 +3,7 @@ build_freebsd_CXX=clang++ build_freebsd_SHA256SUM = sha256sum build_freebsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o + +# freebsd host on freebsd builder: override freebsd host preferences. +freebsd_CC = clang +freebsd_CXX = clang++ diff --git a/depends/builders/openbsd.mk b/depends/builders/openbsd.mk index 4b3214ae810..6aeb1431258 100644 --- a/depends/builders/openbsd.mk +++ b/depends/builders/openbsd.mk @@ -7,3 +7,7 @@ build_openbsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CON build_openbsd_TAR = gtar # openBSD touch doesn't understand -h build_openbsd_TOUCH = touch -m -t 200001011200 + +# openbsd host on openbsd builder: override openbsd host preferences. +openbsd_CC = clang +openbsd_CXX = clang++ From 9f3690b9785a5e818d2b889a395b65f42fd78378 Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Mon, 30 Jun 2025 17:00:24 -0400 Subject: [PATCH 05/15] feature_taproot: sample tx version border values more Currently if the version 3 is selected for an otherwise standard spender, the test will fail. It's unlikely but possible, so change the test to update expectations and sample more aggressively on border values to instigate failures much quicker in the future if another version is made standard. Github-Pull: #32841 Rebased-From: 4be81e9746e9e18923386d6f4945a33885fd98a7 --- test/functional/feature_taproot.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/functional/feature_taproot.py b/test/functional/feature_taproot.py index daf11a9ae6c..a7de240fa5e 100755 --- a/test/functional/feature_taproot.py +++ b/test/functional/feature_taproot.py @@ -641,6 +641,9 @@ SIG_ADD_ZERO = {"failure": {"sign": zero_appender(default_sign)}} DUST_LIMIT = 600 MIN_FEE = 50000 +TX_MAX_STANDARD_VERSION = 3 +TX_STANDARD_VERSIONS = [1, 2, TX_MAX_STANDARD_VERSION] + # === Actual test cases === @@ -1409,7 +1412,7 @@ class TaprootTest(BitcoinTestFramework): while left: # Construct CTransaction with random version, nLocktime tx = CTransaction() - tx.version = random.choice([1, 2, random.getrandbits(32)]) + tx.version = random.choice(TX_STANDARD_VERSIONS + [0, TX_MAX_STANDARD_VERSION + 1, random.getrandbits(32)]) min_sequence = (tx.version != 1 and tx.version != 0) * 0x80000000 # The minimum sequence number to disable relative locktime if random.choice([True, False]): tx.nLockTime = random.randrange(LOCKTIME_THRESHOLD, self.lastblocktime - 7200) # all absolute locktimes in the past @@ -1501,8 +1504,7 @@ class TaprootTest(BitcoinTestFramework): is_standard_tx = ( fail_input is None # Must be valid to be standard and (all(utxo.spender.is_standard for utxo in input_utxos)) # All inputs must be standard - and tx.version >= 1 # The tx version must be standard - and tx.version <= 2) + and tx.version in TX_STANDARD_VERSIONS) # The tx version must be standard tx.rehash() msg = ','.join(utxo.spender.comment + ("*" if n == fail_input else "") for n, utxo in enumerate(input_utxos)) if is_standard_tx: From 59a83fb8d1f9030111a70e8184091e61cef15c38 Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Wed, 2 Jul 2025 11:05:21 -0400 Subject: [PATCH 06/15] functional test: correctly detect nonstd TRUC tx vsize in feature_taproot Github-Pull: #32859 Rebased-From: f0524cda3995cf65adab3d0ca8da0dee4e31c79b --- test/functional/feature_taproot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/functional/feature_taproot.py b/test/functional/feature_taproot.py index a7de240fa5e..4acb7524fba 100755 --- a/test/functional/feature_taproot.py +++ b/test/functional/feature_taproot.py @@ -643,6 +643,7 @@ MIN_FEE = 50000 TX_MAX_STANDARD_VERSION = 3 TX_STANDARD_VERSIONS = [1, 2, TX_MAX_STANDARD_VERSION] +TRUC_MAX_VSIZE = 10000 # test doesn't cover in-mempool spends, so only this limit is hit # === Actual test cases === @@ -1504,7 +1505,9 @@ class TaprootTest(BitcoinTestFramework): is_standard_tx = ( fail_input is None # Must be valid to be standard and (all(utxo.spender.is_standard for utxo in input_utxos)) # All inputs must be standard - and tx.version in TX_STANDARD_VERSIONS) # The tx version must be standard + and tx.version in TX_STANDARD_VERSIONS # The tx version must be standard + and not (tx.version == 3 and tx.get_vsize() > TRUC_MAX_VSIZE) # Topological standardness rules must be followed + ) tx.rehash() msg = ','.join(utxo.spender.comment + ("*" if n == fail_input else "") for n, utxo in enumerate(input_utxos)) if is_standard_tx: From e5a7575a6df8abd5153f29f1df2503146ac81810 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 2 Jul 2025 15:45:00 +0100 Subject: [PATCH 07/15] doc: Add workaround for vcpkg issue with paths with embedded spaces Github-Pull: #32858 Rebased-From: 0a1af4418ed2a135001cc0e10f0af44cbd64e521 --- doc/build-windows-msvc.md | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/doc/build-windows-msvc.md b/doc/build-windows-msvc.md index 915cf4f04b5..27da0bd0785 100644 --- a/doc/build-windows-msvc.md +++ b/doc/build-windows-msvc.md @@ -59,17 +59,6 @@ ctest --test-dir build --build-config Release # Use "-j N" for N parallel tests cmake --install build --config Release # Optional. ``` -If building with `BUILD_GUI=ON`, vcpkg installation during the build -configuration step might fail because of extremely long paths required during -vcpkg installation if your vcpkg instance is installed in the default Visual -Studio directory. This can be avoided without modifying your vcpkg root -directory by changing vcpkg's intermediate build directory with the -`--x-buildtrees-root` argument to something shorter, for example: - -```powershell -cmake -B build --preset vs2022-static -DVCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:\vcpkg" -``` - ### 5. Building with Dynamic Linking without GUI ``` @@ -78,9 +67,30 @@ cmake --build build --config Release # Use "-j N" for N parallel jobs. ctest --test-dir build --build-config Release # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. ``` +### 6. vcpkg-specific Issues and Workarounds + +vcpkg installation during the configuration step might fail for various reasons unrelated to Bitcoin Core. + +If the failure is due to a "Buildtrees path … is too long" error, which is often encountered when building +with `BUILD_GUI=ON` and using the default vcpkg installation provided by Visual Studio, you can +specify a shorter path to store intermediate build files by using +the [`--x-buildtrees-root`](https://learn.microsoft.com/en-us/vcpkg/commands/common-options#buildtrees-root) option: + +```powershell +cmake -B build --preset vs2022-static -DVCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:\vcpkg" +``` + +If vcpkg installation fails with the message "Paths with embedded space may be handled incorrectly", which +can occur if your local Bitcoin Core repository path contains spaces, you can override the vcpkg install directory +by setting the [`VCPKG_INSTALLED_DIR`](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/users/buildsystems/cmake-integration.md#vcpkg_installed_dir) variable: + +```powershell +cmake -B build --preset vs2022-static -DVCPKG_INSTALLED_DIR="C:\path_without_spaces" +``` + ## Performance Notes -### 6. vcpkg Manifest Default Features +### 7. vcpkg Manifest Default Features One can skip vcpkg manifest default features to speedup the configuration step. For example, the following invocation will skip all features except for "wallet" and "tests" and their dependencies: @@ -90,6 +100,6 @@ cmake -B build --preset vs2022 -DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_M Available features are listed in the [`vcpkg.json`](/vcpkg.json) file. -### 7. Antivirus Software +### 8. Antivirus Software To improve the build process performance, one might add the Bitcoin repository directory to the Microsoft Defender Antivirus exclusions. From 83ee49b1dc9b1a086c1ac910e3bcd2ec38dd6d69 Mon Sep 17 00:00:00 2001 From: Salvatore Ingala <6681844+bigspider@users.noreply.github.com> Date: Tue, 1 Jul 2025 09:20:36 +0200 Subject: [PATCH 08/15] doc: clarify that the "-j N" goes after the "--build build" part Also, capitalized the comments in build-unix.md for uniformity with the docs on other targets. Github-Pull: #32846 Rebased-From: 0e9f409db3b7b08aef75ce39765b018b69cc8e9d --- doc/build-freebsd.md | 4 ++-- doc/build-netbsd.md | 4 ++-- doc/build-openbsd.md | 4 ++-- doc/build-osx.md | 4 ++-- doc/build-unix.md | 4 ++-- doc/build-windows-msvc.md | 8 ++++---- doc/build-windows.md | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/build-freebsd.md b/doc/build-freebsd.md index 694224621eb..549d189e7d1 100644 --- a/doc/build-freebsd.md +++ b/doc/build-freebsd.md @@ -129,6 +129,6 @@ cmake -B build -DENABLE_WALLET=OFF ### 2. Compile ```bash -cmake --build build # Use "-j N" for N parallel jobs. -ctest --test-dir build # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. +cmake --build build # Append "-j N" for N parallel jobs. +ctest --test-dir build # Append "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. ``` diff --git a/doc/build-netbsd.md b/doc/build-netbsd.md index 988f3b93a7a..05b80eb7476 100644 --- a/doc/build-netbsd.md +++ b/doc/build-netbsd.md @@ -118,6 +118,6 @@ Run `cmake -B build -LH` to see the full list of available options. Build and run the tests: ```bash -cmake --build build # Use "-j N" for N parallel jobs. -ctest --test-dir build # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. +cmake --build build # Append "-j N" for N parallel jobs. +ctest --test-dir build # Append "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. ``` diff --git a/doc/build-openbsd.md b/doc/build-openbsd.md index 1ad90f23bcc..7ab51054ad2 100644 --- a/doc/build-openbsd.md +++ b/doc/build-openbsd.md @@ -118,8 +118,8 @@ cmake -B build -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include" -DWITH_BDB= ### 2. Compile ```bash -cmake --build build # Use "-j N" for N parallel jobs. -ctest --test-dir build # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. +cmake --build build # Append "-j N" for N parallel jobs. +ctest --test-dir build # Append "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. ``` ## Resource limits diff --git a/doc/build-osx.md b/doc/build-osx.md index 51f3446e44f..3c6c9ad09e6 100644 --- a/doc/build-osx.md +++ b/doc/build-osx.md @@ -187,8 +187,8 @@ After configuration, you are ready to compile. Run the following in your terminal to compile Bitcoin Core: ``` bash -cmake --build build # Use "-j N" here for N parallel jobs. -ctest --test-dir build # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. +cmake --build build # Append "-j N" here for N parallel jobs. +ctest --test-dir build # Append "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. ``` ### 3. Deploy (optional) diff --git a/doc/build-unix.md b/doc/build-unix.md index 85add7fa539..9c46df2a9cb 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -9,8 +9,8 @@ To Build ```bash cmake -B build -cmake --build build # use "-j N" for N parallel jobs -cmake --install build # optional +cmake --build build # Append "-j N" for N parallel jobs +cmake --install build # Optional ``` See below for instructions on how to [install the dependencies on popular Linux diff --git a/doc/build-windows-msvc.md b/doc/build-windows-msvc.md index 27da0bd0785..0d10fecd855 100644 --- a/doc/build-windows-msvc.md +++ b/doc/build-windows-msvc.md @@ -54,8 +54,8 @@ In the following instructions, the "Debug" configuration can be specified instea ``` cmake -B build --preset vs2022-static # It might take a while if the vcpkg binary cache is unpopulated or invalidated. -cmake --build build --config Release # Use "-j N" for N parallel jobs. -ctest --test-dir build --build-config Release # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. +cmake --build build --config Release # Append "-j N" for N parallel jobs. +ctest --test-dir build --build-config Release # Append "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. cmake --install build --config Release # Optional. ``` @@ -63,8 +63,8 @@ cmake --install build --config Release # Optional. ``` cmake -B build --preset vs2022 -DBUILD_GUI=OFF # It might take a while if the vcpkg binary cache is unpopulated or invalidated. -cmake --build build --config Release # Use "-j N" for N parallel jobs. -ctest --test-dir build --build-config Release # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. +cmake --build build --config Release # Append "-j N" for N parallel jobs. +ctest --test-dir build --build-config Release # Append "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available. ``` ### 6. vcpkg-specific Issues and Workarounds diff --git a/doc/build-windows.md b/doc/build-windows.md index 03af0654cea..84db7fa4b5f 100644 --- a/doc/build-windows.md +++ b/doc/build-windows.md @@ -47,9 +47,9 @@ This means you cannot use a directory that is located directly on the host Windo Build using: - gmake -C depends HOST=x86_64-w64-mingw32 # Use "-j N" for N parallel jobs. + gmake -C depends HOST=x86_64-w64-mingw32 # Append "-j N" for N parallel jobs. cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake - cmake --build build # Use "-j N" for N parallel jobs. + cmake --build build # Append "-j N" for N parallel jobs. ## Depends system From 84c0c0e64b799f8f19791e8c71a7a6e10baa1c3b Mon Sep 17 00:00:00 2001 From: ismaelsadeeq Date: Thu, 26 Jun 2025 06:50:19 +0100 Subject: [PATCH 09/15] test: fix incorrect subtest in `feature_fee_estimation.py` - Update `check_smart_estimates` to calculate the fee rate ceiling by taking the maximum of fees seen, minrelaytxfee, and mempoolminfee. - Improve the subtest name and comments. Github-Pull: #32463 Rebased-From: 5c1236f04a24716b2cbd9b9b283863d3a8a6fa87 --- test/functional/feature_fee_estimation.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/functional/feature_fee_estimation.py b/test/functional/feature_fee_estimation.py index 974d8268a2a..3bde3a98bd8 100755 --- a/test/functional/feature_fee_estimation.py +++ b/test/functional/feature_fee_estimation.py @@ -90,19 +90,20 @@ def check_smart_estimates(node, fees_seen): """Call estimatesmartfee and verify that the estimates meet certain invariants.""" delta = 1.0e-6 # account for rounding error - last_feerate = float(max(fees_seen)) all_smart_estimates = [node.estimatesmartfee(i) for i in range(1, 26)] mempoolMinFee = node.getmempoolinfo()["mempoolminfee"] minRelaytxFee = node.getmempoolinfo()["minrelaytxfee"] + feerate_ceiling = max(max(fees_seen), float(mempoolMinFee), float(minRelaytxFee)) + last_feerate = feerate_ceiling for i, e in enumerate(all_smart_estimates): # estimate is for i+1 feerate = float(e["feerate"]) assert_greater_than(feerate, 0) assert_greater_than_or_equal(feerate, float(mempoolMinFee)) assert_greater_than_or_equal(feerate, float(minRelaytxFee)) - if feerate + delta < min(fees_seen) or feerate - delta > max(fees_seen): + if feerate + delta < min(fees_seen) or feerate - delta > feerate_ceiling: raise AssertionError( - f"Estimated fee ({feerate}) out of range ({min(fees_seen)},{max(fees_seen)})" + f"Estimated fee ({feerate}) out of range ({min(fees_seen)},{feerate_ceiling})" ) if feerate - delta > last_feerate: raise AssertionError( @@ -237,10 +238,10 @@ class EstimateFeeTest(BitcoinTestFramework): self.log.info("Final estimates after emptying mempools") check_estimates(self.nodes[1], self.fees_per_kb) - def test_feerate_mempoolminfee(self): - high_val = 3 * self.nodes[1].estimatesmartfee(1)["feerate"] + def test_estimates_with_highminrelaytxfee(self): + high_val = 3 * self.nodes[1].estimatesmartfee(2)["feerate"] self.restart_node(1, extra_args=[f"-minrelaytxfee={high_val}"]) - check_estimates(self.nodes[1], self.fees_per_kb) + check_smart_estimates(self.nodes[1], self.fees_per_kb) self.restart_node(1) def sanity_check_rbf_estimates(self, utxos): @@ -451,11 +452,11 @@ class EstimateFeeTest(BitcoinTestFramework): self.log.info("Test fee_estimates.dat is flushed periodically") self.test_estimate_dat_is_flushed_periodically() - # check that the effective feerate is greater than or equal to the mempoolminfee even for high mempoolminfee + # check that estimatesmartfee feerate is greater than or equal to maximum of mempoolminfee and minrelaytxfee self.log.info( - "Test fee rate estimation after restarting node with high MempoolMinFee" + "Test fee rate estimation after restarting node with high minrelaytxfee" ) - self.test_feerate_mempoolminfee() + self.test_estimates_with_highminrelaytxfee() self.log.info("Test acceptstalefeeestimates option") self.test_acceptstalefeeestimates_option() From f85d41c2249dfd9a343fdc3cfe139218371bf891 Mon Sep 17 00:00:00 2001 From: ismaelsadeeq Date: Thu, 26 Jun 2025 06:56:46 +0100 Subject: [PATCH 10/15] test: retain the intended behavior of `feature_fee_estimation.py` nodes - Increase block weight by 4000 for all nodes with custom -blockmaxweight. Prior to this commit, we generated blocks with 4000 weight units less worth of transactions. See https://github.com/bitcoin/bitcoin/issues/32461#issuecomment-2925282272 for details. This commit fixes it by increasing the block weight by 4000. Github-Pull: #32463 Rebased-From: 9b75cfda4d62a0a3bde402503244dd57e1621a12 --- test/functional/feature_fee_estimation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/feature_fee_estimation.py b/test/functional/feature_fee_estimation.py index 3bde3a98bd8..d6e203290a4 100755 --- a/test/functional/feature_fee_estimation.py +++ b/test/functional/feature_fee_estimation.py @@ -145,8 +145,8 @@ class EstimateFeeTest(BitcoinTestFramework): self.noban_tx_relay = True self.extra_args = [ [], - ["-blockmaxweight=68000"], - ["-blockmaxweight=32000"], + ["-blockmaxweight=72000"], + ["-blockmaxweight=36000"], ] def setup_network(self): From 58b1a65ab0883bb14cb8ffaf76580800a29a92d2 Mon Sep 17 00:00:00 2001 From: Jameson Lopp Date: Sun, 29 Jun 2025 13:07:06 -0400 Subject: [PATCH 11/15] add more bad p2p ports Github-Pull: #32826 Rebased-From: 6967e8e8abbc35ac98e8e3745a8bbed56e77526f --- doc/p2p-bad-ports.md | 5 +++++ src/netbase.cpp | 5 +++++ src/test/netbase_tests.cpp | 13 +++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/doc/p2p-bad-ports.md b/doc/p2p-bad-ports.md index 4f717f97a29..5e78eb799d3 100644 --- a/doc/p2p-bad-ports.md +++ b/doc/p2p-bad-ports.md @@ -87,10 +87,14 @@ incoming connections. 1720: h323hostcall 1723: pptp 2049: nfs + 3306: MySQL + 3389: RDP / Windows Remote Desktop 3659: apple-sasl / PasswordServer 4045: lockd 5060: sip 5061: sips + 5432: PostgreSQL + 5900: VNC 6000: X11 6566: sane-port 6665: Alternate IRC @@ -100,6 +104,7 @@ incoming connections. 6669: Alternate IRC 6697: IRC + TLS 10080: Amanda + 27017: MongoDB For further information see: diff --git a/src/netbase.cpp b/src/netbase.cpp index eaca5a16c10..d3d54048272 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -861,10 +861,14 @@ bool IsBadPort(uint16_t port) case 1720: // h323hostcall case 1723: // pptp case 2049: // nfs + case 3306: // MySQL + case 3389: // RDP / Windows Remote Desktop case 3659: // apple-sasl / PasswordServer case 4045: // lockd case 5060: // sip case 5061: // sips + case 5432: // PostgreSQL + case 5900: // VNC case 6000: // X11 case 6566: // sane-port case 6665: // Alternate IRC @@ -874,6 +878,7 @@ bool IsBadPort(uint16_t port) case 6669: // Alternate IRC case 6697: // IRC + TLS case 10080: // Amanda + case 27017: // MongoDB return true; } return false; diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index 3422cb80233..967378f5201 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -14,6 +14,7 @@ #include #include +#include #include @@ -603,14 +604,10 @@ BOOST_AUTO_TEST_CASE(isbadport) BOOST_CHECK(!IsBadPort(443)); BOOST_CHECK(!IsBadPort(8333)); - // Check all ports, there must be 80 bad ports in total. - size_t total_bad_ports{0}; - for (uint16_t port = std::numeric_limits::max(); port > 0; --port) { - if (IsBadPort(port)) { - ++total_bad_ports; - } - } - BOOST_CHECK_EQUAL(total_bad_ports, 80); + // Check all possible ports and ensure we only flag the expected amount as bad + std::list ports(std::numeric_limits::max()); + std::iota(ports.begin(), ports.end(), 1); + BOOST_CHECK_EQUAL(std::ranges::count_if(ports, IsBadPort), 85); } BOOST_AUTO_TEST_SUITE_END() From bc2147c884d971ec57c782004142b99af6175d9a Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 10 Jul 2025 17:55:34 +0100 Subject: [PATCH 12/15] depends: Force `CMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE` When using CMake policies 3.14 and below, the `export(PACKAGE)` command by default populates the user package registry, which is stored outside the build tree. Setting the `CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable disables this side effect. In CMake 3.15 and later, this behavior is disabled by default, and the variable has no effect. Github-Pull: #32943 Rebased-From: 44f3bae300dcafbe53f9b07e6cc22a112833e579 --- depends/funcs.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/depends/funcs.mk b/depends/funcs.mk index b07432adec9..dce45af9611 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -187,6 +187,7 @@ $(1)_cmake=env CC="$$($(1)_cc)" \ -DCMAKE_INSTALL_LIBDIR=lib/ \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=$(V) \ + -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=TRUE \ $$($(1)_config_opts) ifeq ($($(1)_type),build) $(1)_cmake += -DCMAKE_INSTALL_RPATH:PATH="$$($($(1)_type)_prefix)/lib" From f798c317a08c1fdbc560fa70af624396ec4cb488 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sat, 12 Jul 2025 14:03:35 +0100 Subject: [PATCH 13/15] cmake: Drop no longer necessary "cmakeMinimumRequired" object Github-Pull: #32954 Rebased-From: 12a6959892cb24b940b3579828f2066651572153 --- CMakePresets.json | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakePresets.json b/CMakePresets.json index da838f2b0e3..a94cfa895ca 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,6 +1,5 @@ { "version": 3, - "cmakeMinimumRequired": {"major": 3, "minor": 21, "patch": 0}, "configurePresets": [ { "name": "vs2022", From 730886b92b661ae6fb2731f79f1371262187b1d5 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 30 Jun 2025 17:41:22 +0100 Subject: [PATCH 14/15] depends: fix libevent _WIN32_WINNT usage Starting with version 13.x, the mingw headers will define the value of NTDDI_VERSION, based on the value of _WIN32_WINNT, if that version is < Windows 10. Given that libevent was undefining our _WIN32_WINNT, and redefining it to a value < Windows 10 (0x0501), NTDDI_VERSION was also being defined to that value, leading to functions not being exposed in the mingw-w64 headers; see here: https://github.com/mingw-w64/mingw-w64/blob/9c2668ef77e75ea4d8a6c7d100b14643269caec3/mingw-w64-headers/include/iphlpapi.h#L36-L41. Imports a commit from usptream (a14ff91254f40cf36e0fee199e26fb11260fab49). Fixes #32707. Github-Pull: #32837 Rebased-From: f5647c6c5ae85e9469cfc5df6fcac23752e1695a --- depends/packages/libevent.mk | 4 +- depends/patches/libevent/winver_fixup.patch | 122 ++++++++++++++++++++ 2 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 depends/patches/libevent/winver_fixup.patch diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk index 43c1f741b2d..1f139b1eec8 100644 --- a/depends/packages/libevent.mk +++ b/depends/packages/libevent.mk @@ -5,6 +5,7 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb $(package)_patches=cmake_fixups.patch $(package)_patches += netbsd_fixup.patch +$(package)_patches += winver_fixup.patch $(package)_build_subdir=build # When building for Windows, we set _WIN32_WINNT to target the same Windows @@ -25,7 +26,8 @@ endef define $(package)_preprocess_cmds patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch && \ - patch -p1 < $($(package)_patch_dir)/netbsd_fixup.patch + patch -p1 < $($(package)_patch_dir)/netbsd_fixup.patch && \ + patch -p1 < $($(package)_patch_dir)/winver_fixup.patch endef define $(package)_config_cmds diff --git a/depends/patches/libevent/winver_fixup.patch b/depends/patches/libevent/winver_fixup.patch new file mode 100644 index 00000000000..4995c356f94 --- /dev/null +++ b/depends/patches/libevent/winver_fixup.patch @@ -0,0 +1,122 @@ +Cherry-picked from a14ff91254f40cf36e0fee199e26fb11260fab49. + +move _WIN32_WINNT defintions before first #include + +_WIN32_WINNT and WIN32_LEAN_AND_MEAN need to be defined +before the windows.h is included for the first time. +Avoid the confusion of indirect #include by defining +before any. + +diff --git a/event_iocp.c b/event_iocp.c +index 6b2a2e15..4955e426 100644 +--- a/event_iocp.c ++++ b/event_iocp.c +@@ -23,12 +23,14 @@ + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +-#include "evconfig-private.h" + + #ifndef _WIN32_WINNT + /* Minimum required for InitializeCriticalSectionAndSpinCount */ + #define _WIN32_WINNT 0x0403 + #endif ++ ++#include "evconfig-private.h" ++ + #include + #include + #include +diff --git a/evthread_win32.c b/evthread_win32.c +index 2ec80560..8647f72b 100644 +--- a/evthread_win32.c ++++ b/evthread_win32.c +@@ -23,18 +23,21 @@ + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +-#include "event2/event-config.h" +-#include "evconfig-private.h" + + #ifdef _WIN32 + #ifndef _WIN32_WINNT + /* Minimum required for InitializeCriticalSectionAndSpinCount */ + #define _WIN32_WINNT 0x0403 + #endif +-#include + #define WIN32_LEAN_AND_MEAN ++#endif ++ ++#include "event2/event-config.h" ++#include "evconfig-private.h" ++ ++#ifdef _WIN32 ++#include + #include +-#undef WIN32_LEAN_AND_MEAN + #include + #endif + +diff --git a/evutil.c b/evutil.c +index 9817f086..8537ffe8 100644 +--- a/evutil.c ++++ b/evutil.c +@@ -24,6 +24,14 @@ + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + ++#ifdef _WIN32 ++#ifndef _WIN32_WINNT ++/* For structs needed by GetAdaptersAddresses */ ++#define _WIN32_WINNT 0x0501 ++#endif ++#define WIN32_LEAN_AND_MEAN ++#endif ++ + #include "event2/event-config.h" + #include "evconfig-private.h" + +@@ -31,15 +39,10 @@ + #include + #include + #include +-#define WIN32_LEAN_AND_MEAN + #include +-#undef WIN32_LEAN_AND_MEAN + #include + #include + #include +-#undef _WIN32_WINNT +-/* For structs needed by GetAdaptersAddresses */ +-#define _WIN32_WINNT 0x0501 + #include + #include + #endif +diff --git a/listener.c b/listener.c +index f5c00c9c..d1080e76 100644 +--- a/listener.c ++++ b/listener.c +@@ -24,16 +24,19 @@ + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + ++#ifdef _WIN32 ++#ifndef _WIN32_WINNT ++/* Minimum required for InitializeCriticalSectionAndSpinCount */ ++#define _WIN32_WINNT 0x0403 ++#endif ++#endif ++ + #include "event2/event-config.h" + #include "evconfig-private.h" + + #include + + #ifdef _WIN32 +-#ifndef _WIN32_WINNT +-/* Minimum required for InitializeCriticalSectionAndSpinCount */ +-#define _WIN32_WINNT 0x0403 +-#endif + #include + #include + #include From 5300295083f2e199c22a7ad55e62a8dc7549a76e Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 3 Jul 2025 11:16:58 +0100 Subject: [PATCH 15/15] doc: update release notes for 29.x --- doc/release-notes.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/release-notes.md b/doc/release-notes.md index c60c728ad27..3a39efadbce 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -49,16 +49,25 @@ Notable changes - #31757 wallet: fix crash on double block disconnection - #32553 wallet: Fix logging of wallet version +### P2P + +- #32826 p2p: add more bad ports + ### Test - #32286 test: Handle empty string returned by CLI as None in RPC tests - #32312 test: Fix feature_pruning test after nTime typo fix - #32336 test: Suppress upstream -Wduplicate-decl-specifier in bpfcc +- #32463 test: fix an incorrect feature_fee_estimation.py subtest - #32483 test: fix two intermittent failures in wallet_basic.py - #32630 test: fix sync function in rpc_psbt.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 +- #32823 test: Fix wait_for_getheaders() call in test_outbound_eviction_blocks_relay_only() - #32833 test: Add msgtype to msg_generic slots +- #32841 feature_taproot: sample tx version border values more +- #32850 test: check P2SH sigop count for coinbase tx +- #32859 test: correctly detect nonstd TRUC tx vsize in feature_taproot ### Util @@ -74,10 +83,14 @@ Notable changes - #32568 depends: use "mkdir -p" when installing xproto - #32678 guix: warn and abort when SOURCE_DATE_EPOCH is set - #32690 depends: fix SHA256SUM command on OpenBSD (use GNU mode output) +- #32716 depends: Override host compilers for FreeBSD and OpenBSD - #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 +- #32837 depends: fix libevent _WIN32_WINNT usage +- #32943 depends: Force CMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE +- #32954 cmake: Drop no longer necessary "cmakeMinimumRequired" object ### Gui @@ -98,6 +111,8 @@ Notable changes - #32719 doc, windows: CompanyName "Bitcoin" => "Bitcoin Core project" - #32776 doc: taproot became always active in v24.0 - #32777 doc: fix Transifex 404s +- #32846 doc: clarify that the "-j N" goes after the "--build build" part +- #32858 doc: Add workaround for vcpkg issue with paths with embedded spaces ### CI @@ -116,16 +131,21 @@ Thanks to everyone who directly contributed to this release: - achow101 - benthecarman +- bigspider - Brandon Odiwuor +- brunoerg +- darosior - davidgumberg - dergoegge - enirox001 - fanquake - furszy +- instagibbs - Hennadii Stepanov - hodlinator - ismaelsadeeq - jb55 +- jlopp - josibake - laanwj - luisschwab @@ -133,7 +153,9 @@ Thanks to everyone who directly contributed to this release: - Martin Zumsande - monlovesmango - nervana21 +- pablomartin4btc - rkrux +- ryanofsky - Sjors - theStack - willcl-ark