Merge bitcoin/bitcoin#32863: [29.x] Backports

5300295083f2e199c22a7ad55e62a8dc7549a76e doc: update release notes for 29.x (fanquake)
730886b92b661ae6fb2731f79f1371262187b1d5 depends: fix libevent _WIN32_WINNT usage (fanquake)
f798c317a08c1fdbc560fa70af624396ec4cb488 cmake: Drop no longer necessary "cmakeMinimumRequired" object (Hennadii Stepanov)
bc2147c884d971ec57c782004142b99af6175d9a depends: Force `CMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE` (Hennadii Stepanov)
58b1a65ab0883bb14cb8ffaf76580800a29a92d2 add more bad p2p ports (Jameson Lopp)
f85d41c2249dfd9a343fdc3cfe139218371bf891 test: retain the intended behavior of `feature_fee_estimation.py` nodes (ismaelsadeeq)
84c0c0e64b799f8f19791e8c71a7a6e10baa1c3b test: fix incorrect subtest in `feature_fee_estimation.py` (ismaelsadeeq)
83ee49b1dc9b1a086c1ac910e3bcd2ec38dd6d69 doc: clarify that the "-j N" goes after the "--build build" part (Salvatore Ingala)
e5a7575a6df8abd5153f29f1df2503146ac81810 doc: Add workaround for vcpkg issue with paths with embedded spaces (Hennadii Stepanov)
59a83fb8d1f9030111a70e8184091e61cef15c38 functional test: correctly detect nonstd TRUC tx vsize in feature_taproot (Greg Sanders)
9f3690b9785a5e818d2b889a395b65f42fd78378 feature_taproot: sample tx version border values more (Greg Sanders)
8a4a938db527636aadaa874d733542613b3d14b6 depends: Override host compilers for FreeBSD and OpenBSD (Hennadii Stepanov)
3a57bfaaf9b0712ff080bd8a315c01552735b882 test: Use rehash() in outbound eviction block-relay (pablomartin4btc)
f82015ccfc7c719405e942ef31c4b59865ee576a test: Clarify roles in outbound eviction comments (pablomartin4btc)
222fbfcc6a02ec5bac367e156392d49fb215c066 test: check P2SH sigop count for coinbase tx (brunoerg)

Pull request description:

  Backports
  - #32463
  - #32716
  - #32823
  - #32826
  - #32837
  - #32841
  - #32846
  - #32850
  - #32858
  - #32859
  - #32943
  - #32954

ACKs for top commit:
  hebasto:
    ACK 5300295083f2e199c22a7ad55e62a8dc7549a76e, I've backported all listed PRs locally (had 3 conflicts to resolve), and got zero diff with this PR.
  glozow:
    ACK 5300295083f2e199c22a7ad55e62a8dc7549a76e

Tree-SHA512: c2f764ce3dcd1b6c16bfbe73a548a815f8d7db83653436d17686541a5cb530255a96132865442aa2f569340c95abee31aadda8bf0736582c7a19720029096b1e
This commit is contained in:
merge-script 2025-07-18 13:47:15 -04:00
commit ef380a454c
No known key found for this signature in database
GPG Key ID: BA03F4DBE0C63FB4
21 changed files with 251 additions and 66 deletions

View File

@ -1,6 +1,5 @@
{
"version": 3,
"cmakeMinimumRequired": {"major": 3, "minor": 21, "patch": 0},
"configurePresets": [
{
"name": "vs2022",

View File

@ -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++

View File

@ -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++

View File

@ -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"

View File

@ -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

View File

@ -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 <winsock2.h>
#include <windows.h>
#include <process.h>
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 <winsock2.h>
#define WIN32_LEAN_AND_MEAN
+#endif
+
+#include "event2/event-config.h"
+#include "evconfig-private.h"
+
+#ifdef _WIN32
+#include <winsock2.h>
#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
#include <sys/locking.h>
#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 <winsock2.h>
#include <winerror.h>
#include <ws2tcpip.h>
-#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
#include <io.h>
#include <tchar.h>
#include <process.h>
-#undef _WIN32_WINNT
-/* For structs needed by GetAdaptersAddresses */
-#define _WIN32_WINNT 0x0501
#include <iphlpapi.h>
#include <netioapi.h>
#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 <sys/types.h>
#ifdef _WIN32
-#ifndef _WIN32_WINNT
-/* Minimum required for InitializeCriticalSectionAndSpinCount */
-#define _WIN32_WINNT 0x0403
-#endif
#include <winsock2.h>
#include <winerror.h>
#include <ws2tcpip.h>

View File

@ -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.
```

View File

@ -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.
```

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -54,33 +54,43 @@ 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.
```
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
```
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
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.

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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;

View File

@ -14,6 +14,7 @@
#include <util/translation.h>
#include <string>
#include <numeric>
#include <boost/test/unit_test.hpp>
@ -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<uint16_t>::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<int> ports(std::numeric_limits<uint16_t>::max());
std::iota(ports.begin(), ports.end(), 1);
BOOST_CHECK_EQUAL(std::ranges::count_if(ports, IsBadPort), 85);
}
BOOST_AUTO_TEST_SUITE_END()

View File

@ -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()));

View File

@ -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(
@ -144,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):
@ -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()

View File

@ -641,6 +641,10 @@ 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]
TRUC_MAX_VSIZE = 10000 # test doesn't cover in-mempool spends, so only this limit is hit
# === Actual test cases ===
@ -1409,7 +1413,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 +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 >= 1 # The tx version must be standard
and tx.version <= 2)
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:

View File

@ -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:
@ -233,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")