Commit Graph

44778 Commits

Author SHA1 Message Date
Ava Chow
95bb305b96 Merge bitcoin/bitcoin#32429: docs: Improve keypoolrefill RPC docs
ff35a4b021 docs: Improve `keypoolrefill` RPC docs (w0xlt)

Pull request description:

  Update `keypoolrefill` RPC docs to make it clear that descriptor wallets have 4 ScriptPubKeyManagers by default and each of them is updated in this command, as suggested https://github.com/bitcoin/bitcoin/issues/29924#issuecomment-2849321859

  Closes https://github.com/bitcoin/bitcoin/issues/29924

ACKs for top commit:
  achow101:
    ACK ff35a4b021
  brunoerg:
    code review ACK ff35a4b021

Tree-SHA512: b6b9abe3fecebf9551b4ce9280794292c6ac44ccaeb2b9d60eeb4b2c177fe8372d0fe103f99c9cc0baeb2559ec019d1c495c233f24a600531153a38eeacb9670
2025-05-07 14:55:49 -07:00
Ava Chow
1b1b9f32cf Merge bitcoin/bitcoin#32440: test: remove bdb assert in tool_wallet.py
e08e6567f2 test: remove assert_dump since it is not used anymore (kevkevinpal)
4b6dd9790b test: remove bdb assert in tool_wallet.py (kevkevinpal)

Pull request description:

  As suggested in https://github.com/bitcoin/bitcoin/pull/32438#issuecomment-2859123413

  legacy wallet and the BDB dependency was removed (https://github.com/bitcoin/bitcoin/pull/28710) so this assert is safe to delete

ACKs for top commit:
  davidgumberg:
    reACK e08e6567f2
  achow101:
    ACK e08e6567f2
  brunoerg:
    reACK e08e6567f2
  theStack:
    re-ACK e08e6567f2

Tree-SHA512: 6417537d7b9b5da6039dfcc94a86107211d57dcca43becea6f95d4a95f342e12918b0ff6a562261ba538b7b206de7d327e52bdb7d49e353f1917df8668558a99
2025-05-07 11:51:17 -07:00
kevkevinpal
e08e6567f2 test: remove assert_dump since it is not used anymore 2025-05-07 14:18:12 -04:00
w0xlt
ff35a4b021 docs: Improve keypoolrefill RPC docs 2025-05-07 14:44:10 -03:00
kevkevinpal
4b6dd9790b test: remove bdb assert in tool_wallet.py 2025-05-07 13:02:54 -04:00
Hennadii Stepanov
7343a1846c depends: Avoid using helper variables in toolchain file
Using helper variables has two issues:
1. They contaminate the global namespace of the main build script.
2. They can be used as `set(var)`, effectively exposing a cache variable
`var`, which makes the toolchain file susceptible to the build
environment.
2025-05-07 17:02:53 +01:00
merge-script
efac285a0d Merge bitcoin/bitcoin#28710: Remove the legacy wallet and BDB dependency
de054df6dc contrib: Remove legacy wallet RPCs from bash completions (Ava Chow)
5dff04a1bb legacy spkm: Make IsMine() and CanProvide() private and migration only (Ava Chow)
c0f3f3264f wallet: Remove unused db functions (Ava Chow)
83af1a3cca wallet: Delete LegacySPKM (Ava Chow)
8ede6dea0c wallet, rpc: Remove legacy wallet only RPCs (Ava Chow)
4de3cec28d test: rpcs disabled for descriptor wallets will be removed (Ava Chow)
84f671b01d test: Run multisig script limit test (Ava Chow)
810476f31e test: Remove unused options and variables, correct comments (Ava Chow)
04a7a7a28c build, wallet, doc: Remove BDB (Ava Chow)

Pull request description:

  The final step of #20160.

  A bare minimum of legacy wallet code is kept in order to perform wallet migration. Migration of legacy wallets uses the independent BDB parser and a minimal `LegacyDataSPKM` that allows the legacy data to be loaded so that the migration can be completed.

  BDB has been removed as a dependency and documentation have been updated to reflect that.

ACKs for top commit:
  Sjors:
    re-ACK de054df6dc
  maflcko:
    re-ACK de054df6dc 🔗
  w0xlt:
    reACK de054df6dc
  rkrux:
    Concept ACK de054df6dc

Tree-SHA512: 16a6c265bc1ada5e7a5ef9b95f0ff65015672ca46d9a43b7e10d60e9e085052e9bbfe01ac3e494cc606afb652a1b476b10e434d13e9877b67d2cb0196a9bd190
2025-05-07 15:19:17 +01:00
MarcoFalke
fa24fdcb7f lint: Remove string exclusion from locale check
The string exclusion would fail to detect `"bla" + wrong()`.

Also, remove /* */ comment exclusion, which would fail to detect stuff
like `/* bla */ wrong()`.

Instead, require the function to be called by adding \\( to the regex.

Finally, also remove the section in the dev notes, because:

* It was outdated and missing some functions such as std::to_string in
  the list.
* The maintenance overhead of having to update two places is fragile and
  questionable.
* Many other linters are also not mentioned in the dev notes, even
  though they are important.
* A dev (and CI) is more likely to run the linters than to read the dev
  notes.
* The dev notes are more than 1000 lines of dense information. It would
  be easier to digest if they focused on the important stuff that is not
  checked by automated tools.
2025-05-07 13:24:41 +02:00
fanquake
4e8ab5e00f crypto: disable ASan for sha256_sse4 with Clang
This can alsofail to compile when optimisations are being used, see:
https://github.com/bitcoin/bitcoin/issues/31913.
So disable just ASan for this function under any optimisation level.
2025-05-07 11:53:21 +01:00
merge-script
6d5edfcc58 Merge bitcoin/bitcoin#32388: fuzz: Remove unused TimeoutExpired catch in fuzz runner
fa4804009c fuzz: Remove unused TimeoutExpired catch in fuzz runner (MarcoFalke)

Pull request description:

  Currently, the way to check for libFuzzer is to search the stderr of the fuzz executable when passed `-help=1` for the string `libFuzzer`. See also 14b8dfb2bd/contrib/devtools/deterministic-fuzz-coverage/src/main.rs (L90-L101)

  The python test runner additionally includes a timeout catch, which was needed before the plain `read_file` fallback was implemented, see 14b8dfb2bd/src/test/fuzz/fuzz.cpp (L251).

  However, it is no longer needed and the printed error message would be wrong, so remove it.

  (side-note: On Windows the fuzz executable seems to time out when an assert is hit in a debug build, see https://github.com/bitcoin/bitcoin/issues/32341#issuecomment-2842716175. However, no one is running fuzz debug on Windows. Also, the newly added debug logging is a preferable replacement in this case anyway.)

ACKs for top commit:
  kevkevinpal:
    crACK [fa48040](fa4804009c)
  Crypt-iQ:
    crACK fa4804009c
  marcofleon:
    crACK fa4804009c
  brunoerg:
    code review ACK fa4804009c

Tree-SHA512: 64f5e3862fece9ab2b6592615b72b81e9c087dcd394b1d062a96df0d88d8b5999674f0faa1165a5998c05289c1874e29311d7b24d84fee9bc6c46d1662d29e4d
2025-05-07 11:52:09 +01:00
Ava Chow
de054df6dc contrib: Remove legacy wallet RPCs from bash completions
These RPCs no longer exist.
2025-05-06 16:53:16 -07:00
Ava Chow
5dff04a1bb legacy spkm: Make IsMine() and CanProvide() private and migration only 2025-05-06 16:53:16 -07:00
Ava Chow
c0f3f3264f wallet: Remove unused db functions
SOme db functions were for BDB, these are no longer needed.
2025-05-06 16:53:16 -07:00
Ava Chow
83af1a3cca wallet: Delete LegacySPKM
Deletes LegacyScriptPubKeyMan and related tests

Best reviewed with `git diff --patience` or `git diff --histogram`
2025-05-06 16:53:16 -07:00
Ava Chow
59d3e4ed34 Merge bitcoin/bitcoin#32415: scripted-diff: adapt script error constant names in feature_taproot.py
b5f580c580 scripted-diff: adapt script error constant names in feature_taproot.py (Sebastian Falbesoner)

Pull request description:

  While reviewing #31622 I noticed that the constant name `(SCRIPT_)ERR_SIG_HASHTYPE` is used for two different script verification error codes, namely one for legacy and one for Schnorr signatures:

  eba5f9c4b6/src/script/script_error.cpp (L56-L57)
  eba5f9c4b6/test/functional/feature_taproot.py (L600)

  In order to resolve this confusion, this PR adapts all script error constant names in the functional tests (currently only in feature_taproot.py) to the ones used in our C++ codebase (see [script_error.cpp](https://github.com/bitcoin/bitcoin/blob/master/src/script/script_error.cpp)) with a scripted diff. This also makes checking whether we have test coverage for a certain script error easier.

ACKs for top commit:
  jamesob:
    crACK b5f580c580
  achow101:
    ACK b5f580c580
  rkrux:
    tACK b5f580c580
  stratospher:
    ACK b5f580c. liked the consistency in script error names.

Tree-SHA512: bc0ccec70bc3cb6ce51ce8e27a5e54770d1bb93c1db5a9c815caa25f3d96ebb382104bd9b51626f501d4f5b95148db8d20c806a27153e9bb9cf823a20d3046c0
2025-05-06 15:25:57 -07:00
Ava Chow
fffb272c25 Merge bitcoin/bitcoin#29532: Refactor BnB tests
85368aafa0 test: Run simple tests at various feerates (Murch)
d610951c15 test: Recreate BnB iteration exhaustion test (Murch)
2a1b2754f1 test: Remove redundant repeated test (Murch)
4781f5c8be test: Recreate simple BnB failure tests (Murch)
a94030ae98 test: Recreate BnB clone skipping test (Murch)
7db6f012c0 test: Move BnB feerate sensitivity tests (Murch)
2bafc46261 test: Recreate simple BnB success tests (Murch)

Pull request description:

  This PR is splitting off some of the improvements made in #28985 and starts addressing the issues raised in #27754.

  I aim to completely replace `coinselector_tests` with `coinselection_tests`. The goal is to generally use coins created per a nominal _effective value_ so we can get away from testing with `CoinSelectionParams` that are non-representative and effectuate counterintuitive behavior such as `feerate = 0` or `cost_of_change = 0`

ACKs for top commit:
  achow101:
    ACK 85368aafa0
  monlovesmango:
    ACK 85368aafa0
  w0xlt:
    ACK 85368aafa0

Tree-SHA512: 1a984837b4efddc0d8abe11668898fb207fb539e784bf911d4038211274b82e0fe1f8fffe7e5a19e0e013ccb7dc40e3f62d853a2a729980d0d935e66f12b9156
2025-05-06 15:15:13 -07:00
Hennadii Stepanov
3bbdbc0a5e qt, docs: Unify term "clipboard" 2025-05-06 22:06:24 +01:00
Ava Chow
8ede6dea0c wallet, rpc: Remove legacy wallet only RPCs 2025-05-06 12:33:16 -07:00
Ava Chow
4de3cec28d test: rpcs disabled for descriptor wallets will be removed 2025-05-06 12:33:16 -07:00
Ava Chow
84f671b01d test: Run multisig script limit test
This test was mistakenly disabled.
2025-05-06 12:33:16 -07:00
Ava Chow
810476f31e test: Remove unused options and variables, correct comments 2025-05-06 12:33:16 -07:00
Ava Chow
04a7a7a28c build, wallet, doc: Remove BDB 2025-05-06 12:21:32 -07:00
merge-script
44057fe38c Merge bitcoin/bitcoin#32287: build: Fix macdeployqtplus after switching to Qt 6
84de8c93e7 ci: Add `deploy` target for native macOS CI job (Hennadii Stepanov)
fad57e9e0f build: Fix `macdeployqtplus` after switching to Qt 6 (Hennadii Stepanov)
938208d91a build: Resolve `@rpath` in `macdeployqtplus` (Hennadii Stepanov)

Pull request description:

  Homebrew's Qt 6 package — namely `qt` or `qt@6` — introduces a few differences that must be properly handled by the `macdeployqtplus` script:

  1. Use of `@rpath` references:
  ```
  % objdump --macho --dylibs-used $(brew --prefix qt@5)/Frameworks/QtGui.framework/QtGui
  /usr/local/opt/qt@5/Frameworks/QtGui.framework/QtGui:
  /usr/local/opt/qt@5/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.15.0, current version 5.15.16)
  /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2575.30.19)
  /System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 367.6.0)
  /usr/local/Cellar/qt@5/5.15.16_1/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.15.0, current version 5.15.16)
  /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
  /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
  /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1889.2.7)
  /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 3208.0.0)
  /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
  /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
  /usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 64.0.0, current version 64.0.0)
  /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
  /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 65.0.0)
  /usr/local/opt/md4c/lib/libmd4c.0.dylib (compatibility version 0.0.0, current version 0.5.2)
  /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1800.105.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1351.0.0)
  /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 3208.0.0)
  /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 844.2.0)
  /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
  % objdump --macho --dylibs-used $(brew --prefix qt@6)/Frameworks/QtGui.framework/QtGui
  /usr/local/opt/qt/Frameworks/QtGui.framework/QtGui:
  /usr/local/opt/qt/lib/QtGui.framework/Versions/A/QtGui (compatibility version 6.0.0, current version 6.9.0)
  /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2575.30.19)
  /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 170.0.0)
  /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
  /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)
  /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 3208.0.0)
  /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1889.2.7)
  /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 844.2.0)
  /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 3208.0.0)
  /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0)
  /System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 367.6.0)
  /usr/local/opt/glib/lib/libglib-2.0.0.dylib (compatibility version 8401.0.0, current version 8401.0.0)
  @rpath/QtDBus.framework/Versions/A/QtDBus (compatibility version 6.0.0, current version 6.9.0)
  /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
  /usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 64.0.0, current version 64.0.0)
  /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
  /usr/local/opt/harfbuzz/lib/libharfbuzz.0.dylib (compatibility version 61100.0.0, current version 61100.0.0)
  /usr/local/opt/md4c/lib/libmd4c.0.dylib (compatibility version 0.0.0, current version 0.5.2)
  /usr/local/opt/freetype/lib/libfreetype.6.dylib (compatibility version 27.0.0, current version 27.2.0)
  /usr/local/opt/glib/lib/libgthread-2.0.0.dylib (compatibility version 8401.0.0, current version 8401.0.0)
  @rpath/QtCore.framework/Versions/A/QtCore (compatibility version 6.0.0, current version 6.9.0)
  /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
  /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
  /System/Library/Frameworks/UniformTypeIdentifiers.framework/Versions/A/UniformTypeIdentifiers (compatibility version 1.0.0, current version 709.0.0)
  /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1800.105.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1351.0.0)
  /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1226.0.0)
  /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
  ```

  2. Different directory layout:
  ```
  % ls -l $(brew --prefix qt@5)/
  total 544
  drwxr-xr-x   79 hebasto  admin    2528 13 Nov 06:22 Frameworks
  -rw-r--r--    1 hebasto  admin    7533 16 Apr 09:09 INSTALL_RECEIPT.json
  -rw-r--r--    1 hebasto  admin   22961 13 Nov 06:22 LICENSE.FDL
  -rw-r--r--    1 hebasto  admin   36363 13 Nov 06:22 LICENSE.GPL3-EXCEPT
  -rw-r--r--    1 hebasto  admin   15351 13 Nov 06:22 LICENSE.GPLv2
  -rw-r--r--    1 hebasto  admin   35641 13 Nov 06:22 LICENSE.GPLv3
  -rw-r--r--    1 hebasto  admin   26828 13 Nov 06:22 LICENSE.LGPLv21
  -rw-r--r--    1 hebasto  admin    8174 13 Nov 06:22 LICENSE.LGPLv3
  -rw-r--r--    1 hebasto  admin  106262 13 Nov 06:22 LICENSE.QT-LICENSE-AGREEMENT
  -rw-r--r--    1 hebasto  admin    3842 13 Nov 06:22 README
  drwxr-xr-x   57 hebasto  admin    1824 16 Apr 09:09 bin
  drwxr-xr-x    4 hebasto  admin     128 13 Nov 06:22 doc
  drwxr-xr-x   95 hebasto  admin    3040 13 Nov 06:22 include
  drwxr-xr-x  119 hebasto  admin    3808 16 Apr 09:09 lib
  drwxr-xr-x    8 hebasto  admin     256 13 Nov 06:22 libexec
  drwxr-xr-x   79 hebasto  admin    2528 16 Apr 09:09 mkspecs
  drwxr-xr-x   15 hebasto  admin     480 13 Nov 06:22 phrasebooks
  drwxr-xr-x   31 hebasto  admin     992 13 Nov 06:22 plugins
  drwxr-xr-x   28 hebasto  admin     896 13 Nov 06:22 qml
  -rw-r--r--    1 hebasto  admin    6952 16 Apr 09:09 sbom.spdx.json
  drwxr-xr-x    3 hebasto  admin      96 13 Nov 06:22 share
  drwxr-xr-x  347 hebasto  admin   11104 13 Nov 06:22 translations
  % ls -l $(brew --prefix qt@6)/share/qt/
  total 0
  drwxr-xr-x    4 hebasto  admin   128 30 Mar 09:49 doc
  drwxr-xr-x   35 hebasto  admin  1120 16 Apr 09:16 libexec
  drwxr-xr-x  167 hebasto  admin  5344 30 Mar 09:49 metatypes
  drwxr-xr-x   70 hebasto  admin  2240 16 Apr 09:16 mkspecs
  drwxr-xr-x  178 hebasto  admin  5696 30 Mar 09:49 modules
  drwxr-xr-x   15 hebasto  admin   480 30 Mar 09:49 phrasebooks
  drwxr-xr-x   31 hebasto  admin   992 30 Mar 09:49 plugins
  drwxr-xr-x   34 hebasto  admin  1088 30 Mar 09:49 qml
  drwxr-xr-x   45 hebasto  admin  1440 30 Mar 09:49 sbom
  drwxr-xr-x  285 hebasto  admin  9120 30 Mar 09:49 translations
  ```

  This PR addresses both issues and additionally adds a `deploy` target to the native macOS CI job to prevent any similar recessions in the future.

  Fixes https://github.com/bitcoin/bitcoin/issues/32267.

ACKs for top commit:
  fanquake:
    ACK 84de8c93e7

Tree-SHA512: 27a0eff3cd9317647529ff4571bd79c5dd8f007775b19415c8c27ca4912a60d85074c840cf0443be314d9a404f78bb015029d46dab18e292462249a5d90c6c47
2025-05-06 18:10:22 +01:00
merge-script
229943b513 Merge bitcoin/bitcoin#32086: Shuffle depends instructions and recommend modern make for macOS
22cff32319 doc: recommend gmake for FreeBSD (Sjors Provoost)
b645c52071 doc: recommend modern make for macOS depends (Sjors Provoost)
99e6490dc5 doc: shuffle depends instructions (Sjors Provoost)

Pull request description:

  macOS ships with GNU Make 3.81 from 2006. This has caused
  difficult to debug issues, e.g. #32070 and #30978.

  Tell users / developers who use the depends system to install a modern version of `make`.

  This PR does not change the non-depends build.

  Although Homebrew allows overriding the system `make`, we instead just instruct users to build with `gmake`. This way there should be no impact on other projects they wish to compile.

  To increase the likeliness of anyone actually seeing and following this instruction, the first commit moves things around in `depends/README.md`. It now starts with instructions for a local build and moves cross-compilation to the end. For each platform it shows what to install (`apt install`, `brew install`, etc) and what command to run (`make` or `gmake`).

  There previously was no macOS specific section, so this is added. It points to the general `build-osx.md` for how to install the Xcode Command Line Tools and Homebrew Package Manager.

  I didn't test on an empty system.

  Preview: https://github.com/Sjors/bitcoin/tree/2025/03/mc-make/depends#depends-build

ACKs for top commit:
  maflcko:
    review ACK 22cff32319 🏣
  hebasto:
    re-ACK 22cff32319.
  willcl-ark:
    ACK 22cff32319

Tree-SHA512: 11648ae73f3b70bc2df771e4eddca37221cd88b88bea4139a183e3f67f24a4c3e5aadf61a713ed73f3fc206511dfcf8670e4c4143c49dd4e56e501030be9c7ba
2025-05-06 18:06:38 +01:00
Hennadii Stepanov
edde96376a cmake: Respect user-provided configuration-specific flags 2025-05-06 13:25:35 +01:00
Sjors Provoost
22cff32319 doc: recommend gmake for FreeBSD
Consistent with doc/build-freebsd.md
2025-05-06 11:24:32 +02:00
Sjors Provoost
b645c52071 doc: recommend modern make for macOS depends
macOS ships with GNU Make 3.81 from 2006. This has caused
difficult to debug issues, see e.g.
9157d9e449.

Also add ninja, needed since qt6.
2025-05-06 11:24:32 +02:00
Sjors Provoost
99e6490dc5 doc: shuffle depends instructions
Native compilation is explained before cross-compilation. Move
install and (g)make steps up.

In the Configuring section, use Linux native compilation as the
example instead of Windows cross-compile.
2025-05-06 11:24:16 +02:00
Hennadii Stepanov
baa848b8d3 Merge bitcoin/bitcoin#32405: build: replace header checks with __has_include
e1f543823b build: replace header checks with __has_include (fanquake)

Pull request description:

  Replace the checks in CMake, with the equivalent functionality provided by the standard library (since C++17).
  See https://en.cppreference.com/w/cpp/preprocessor/include.

  Guix Build:
  ```bash
  66d71c866bd111ffe65bc03b9e1653a95eb678f0b04451759c56af868bfc03d5  guix-build-e1f543823b30/output/aarch64-linux-gnu/SHA256SUMS.part
  1a4130d801620a63d86c3069b1fbca39ebc963e610101451d3f48b1c191ca4b3  guix-build-e1f543823b30/output/aarch64-linux-gnu/bitcoin-e1f543823b30-aarch64-linux-gnu-debug.tar.gz
  745adbc7767344a8cd0ebe1e7592239614d89f949558c9b6a2ae58f7b2602a32  guix-build-e1f543823b30/output/aarch64-linux-gnu/bitcoin-e1f543823b30-aarch64-linux-gnu.tar.gz
  cb69d205a20715ee58a324cc2b8475c2bae0443a062f5de2820baa45f822292c  guix-build-e1f543823b30/output/arm-linux-gnueabihf/SHA256SUMS.part
  081774dd903256dafa187ee47a569cd44b01eb16adc9dbfeb54b721abc39e944  guix-build-e1f543823b30/output/arm-linux-gnueabihf/bitcoin-e1f543823b30-arm-linux-gnueabihf-debug.tar.gz
  1dd857fe6b9e75fae746e73fbfc6b77302b4dbb13685baebb10e9686da7bad01  guix-build-e1f543823b30/output/arm-linux-gnueabihf/bitcoin-e1f543823b30-arm-linux-gnueabihf.tar.gz
  e035ba959da69263de2f29282328d4e5b455f94a800a15891801f26ba3b8b325  guix-build-e1f543823b30/output/arm64-apple-darwin/SHA256SUMS.part
  ebf973e0e44be688ea5e1ebae804dfce6e71b7ca8aaca5d8249a14d130f37c3f  guix-build-e1f543823b30/output/arm64-apple-darwin/bitcoin-e1f543823b30-arm64-apple-darwin-codesigning.tar.gz
  3ea687b53032b30d7c4a0760f8a35d19e2f60a8cb3f1f5e2c5cba05897f04e43  guix-build-e1f543823b30/output/arm64-apple-darwin/bitcoin-e1f543823b30-arm64-apple-darwin-unsigned.tar.gz
  ebb6a935f2fbc75167f5e61a039d13f231621f7eb0cbd1292616425f7677739c  guix-build-e1f543823b30/output/arm64-apple-darwin/bitcoin-e1f543823b30-arm64-apple-darwin-unsigned.zip
  9e77422977506f0c3f0373ee19d24c3ad86cbaf3a97cfcf5db202d4fff9c3ae4  guix-build-e1f543823b30/output/dist-archive/bitcoin-e1f543823b30.tar.gz
  62d7c8f63a3702b066f88498f829b2c371baa06c596b71b6d8969f638cc2d356  guix-build-e1f543823b30/output/powerpc64-linux-gnu/SHA256SUMS.part
  60c00fc85dea24548c212330e5fa097020f17bb74f511e7e764b8b33224afce0  guix-build-e1f543823b30/output/powerpc64-linux-gnu/bitcoin-e1f543823b30-powerpc64-linux-gnu-debug.tar.gz
  97b1aa4dc967c9a3767476a262a503900ea77e15b4b292928c6cdddf306cafc9  guix-build-e1f543823b30/output/powerpc64-linux-gnu/bitcoin-e1f543823b30-powerpc64-linux-gnu.tar.gz
  ed67fbb0768ce7b1d4d053de2ba0ea3b2798d01a276adf6430c4a2a413461ee2  guix-build-e1f543823b30/output/riscv64-linux-gnu/SHA256SUMS.part
  83f7b4e6c244d97caa2eb41b67cdef2bfa71f2f3ef1cfa378fae32db18fc8e25  guix-build-e1f543823b30/output/riscv64-linux-gnu/bitcoin-e1f543823b30-riscv64-linux-gnu-debug.tar.gz
  c8ca7793fdfac2346a21d5fc8f6e00f1feb6556d048896fef8148ac614921050  guix-build-e1f543823b30/output/riscv64-linux-gnu/bitcoin-e1f543823b30-riscv64-linux-gnu.tar.gz
  a3e99dd3369aa97cad2437fc1b29f84a8950327fd0f0a1c0a8a3e7ce49369f1a  guix-build-e1f543823b30/output/x86_64-apple-darwin/SHA256SUMS.part
  1c22d2967c72a5b901d54b9914d243aaf8f52216e48399f09bf17f34455369ec  guix-build-e1f543823b30/output/x86_64-apple-darwin/bitcoin-e1f543823b30-x86_64-apple-darwin-codesigning.tar.gz
  28c731d91d84f41a0b94cfb420474f150edd2bd33db1e9c38d52c9452e44b3f1  guix-build-e1f543823b30/output/x86_64-apple-darwin/bitcoin-e1f543823b30-x86_64-apple-darwin-unsigned.tar.gz
  f6b74d1756af4de4a7e250c11f0a48a93fafc67139951afc4a55888ce24dc01a  guix-build-e1f543823b30/output/x86_64-apple-darwin/bitcoin-e1f543823b30-x86_64-apple-darwin-unsigned.zip
  16d7a33003e89f53b3d8ce31a121250a4f836c83482f39b0c40721a2dd32faca  guix-build-e1f543823b30/output/x86_64-linux-gnu/SHA256SUMS.part
  d17606b3fec3c045d84dadff4b107186cc6e51daa80a16588de4e213585a98cd  guix-build-e1f543823b30/output/x86_64-linux-gnu/bitcoin-e1f543823b30-x86_64-linux-gnu-debug.tar.gz
  52ee77c9ff6bbe6965100165847d107c4e3ddcf8c2a960746f663ade074295a5  guix-build-e1f543823b30/output/x86_64-linux-gnu/bitcoin-e1f543823b30-x86_64-linux-gnu.tar.gz
  daeba27cb9ce21e3a6a01b9487ef81738eec0c84ad80ca0ba1287412c0d4eeda  guix-build-e1f543823b30/output/x86_64-w64-mingw32/SHA256SUMS.part
  38ccc35fe32895688f4fc0f22ed8a03233d06636a487b49de74a215fc6b67002  guix-build-e1f543823b30/output/x86_64-w64-mingw32/bitcoin-e1f543823b30-win64-codesigning.tar.gz
  22863abb1a4d1fed1e4753e602f33a743296caf297bdc7ed9330010f5d3f79f3  guix-build-e1f543823b30/output/x86_64-w64-mingw32/bitcoin-e1f543823b30-win64-debug.zip
  1cbc8ae43899d96664e75fa2c3fce2efbb2cfac34b279fe1e240a616646cb3e9  guix-build-e1f543823b30/output/x86_64-w64-mingw32/bitcoin-e1f543823b30-win64-setup-unsigned.exe
  b6d22f62c083aca24dc788df1676bfc2ce0abc85a796a4823e5802d71482082c  guix-build-e1f543823b30/output/x86_64-w64-mingw32/bitcoin-e1f543823b30-win64-unsigned.zip
  ```

ACKs for top commit:
  shahsb:
    ACK e1f543823b
  purpleKarrot:
    ACK e1f543823b
  TheCharlatan:
    ACK e1f543823b
  hebasto:
    ACK e1f543823b, I have reviewed the code and it looks OK.

Tree-SHA512: d4bcbc37d431113f0e6367e8f61e71ab9d9ef8a08c38a2db961d9f9cc8473636124f5f2bd4d66cbb3e5032f9d5f978d7d286033d80f7e148f9d571ff09f005ff
2025-05-05 15:19:20 +01:00
Hennadii Stepanov
53ccb75f0c Merge bitcoin/bitcoin#32358: subprocess: Backport upstream changes
cd95c9d6a7 subprocess: check and handle fcntl(F_GETFD) failure (Tomás Andróil)
b7288decdf subprocess: Proper implementation of wait() on Windows (Haowen Liu)
7423214d8d subprocess: Do not escape double quotes for command line arguments on Windows (Hennadii Stepanov)
bb9ffea53f subprocess: Explicitly define move constructor of Streams class (Shunsuke Shimizu)
174bd43f2e subprocess: Avoid leaking POSIX name aliases beyond `subprocess.h` (Hennadii Stepanov)
7997b7656f subprocess: Fix cross-compiling with mingw toolchain (Hennadii Stepanov)
647630462f subprocess: Get Windows return code in wait() (Haowen Liu)
d3f511b458 subprocess: Fix string_arg when used with rref (Haowen Liu)
2fd3f2fec6 subprocess: Fix memory leaks (Haoran Peng)

Pull request description:

  Most of these changes were developed during work on https://github.com/bitcoin/bitcoin/pull/29868 and https://github.com/bitcoin/bitcoin/pull/32342 and have since been upstreamed.

  As they are now merged, this PR backports them to our `src/util/subprocess.h` header.

  Required for https://github.com/bitcoin/bitcoin/pull/29868.

  A list of the backported PRs:
   - https://github.com/arun11299/cpp-subprocess/pull/106
  - https://github.com/arun11299/cpp-subprocess/pull/110
  - https://github.com/arun11299/cpp-subprocess/pull/109
  - https://github.com/arun11299/cpp-subprocess/pull/99
  - https://github.com/arun11299/cpp-subprocess/pull/112
  - https://github.com/arun11299/cpp-subprocess/pull/107
  - https://github.com/arun11299/cpp-subprocess/pull/113
  - https://github.com/arun11299/cpp-subprocess/pull/116
  - https://github.com/arun11299/cpp-subprocess/pull/117

  The following PRs were skipped for backporting:
  - https://github.com/arun11299/cpp-subprocess/pull/108 because we are not planning to support this feature.
  - https://github.com/arun11299/cpp-subprocess/pull/101 because that change has been already landed in https://github.com/bitcoin/bitcoin/pull/29849.

ACKs for top commit:
  theStack:
    Light ACK cd95c9d6a7
  laanwj:
    Code review re-ACK cd95c9d6a7

Tree-SHA512: f9b60b932957d2e1cad1d87f2ad8bb68c97136e9735eb78547018a42cc50c4652750367f29462eadb0512c27db1dd8a7d4b17a2f0aeab62b3dbf86db5f51a61c
2025-05-05 12:35:42 +01:00
Hennadii Stepanov
fa2c548429 Merge bitcoin/bitcoin#32417: doc: Explain that .gitignore is not for IDE-specific excludes
fada115cbe doc: Explain that .gitignore is not for IDE-specific excludes (MarcoFalke)

Pull request description:

  This comes up frequently, so document it.

  Examples:

  * https://github.com/bitcoin/bitcoin/pull/27275
  * https://github.com/bitcoin/bitcoin/pull/21894
  * https://github.com/bitcoin/bitcoin/pull/32392
  * https://github.com/bitcoin/bitcoin/pull/17868

  ...

ACKs for top commit:
  l0rinc:
    ACK fada115cbe
  hebasto:
    ACK fada115cbe.
  janb84:
    ACK [fada115](fada115cbe)

Tree-SHA512: 6fd1e48de54b40118a49ef61ad157fea278bba568286a022559a4815e53f26650db98a779a1ea2b3085237ded5cbee20d4c2dd1ef51e6a2d3d6085d7063f5309
2025-05-05 07:40:08 +01:00
MarcoFalke
fada115cbe doc: Explain that .gitignore is not for IDE-specific excludes 2025-05-04 19:45:11 +02:00
Sebastian Falbesoner
b5f580c580 scripted-diff: adapt script error constant names in feature_taproot.py
In order to remove potential confusion, this commit adapts all script
error constant names in the functional tests (currently only in
feature_taproot.py) to the ones used in our C++ codebase. This also
makes checking whether we have test coverage for a certain script error
easier.

-BEGIN VERIFY SCRIPT-

ren() { sed -i "s|$1|$2|g" $( git grep -l "$1" -- "./test" ) ; }

ren ERR_SIG_SIZE          ERR_SCHNORR_SIG_SIZE
ren ERR_SIG_HASHTYPE      ERR_SCHNORR_SIG_HASHTYPE
ren ERR_SIG_SCHNORR       ERR_SCHNORR_SIG
ren ERR_CONTROLBLOCK_SIZE ERR_TAPROOT_WRONG_CONTROL_SIZE
ren ERR_PUSH_LIMIT        ERR_PUSH_SIZE
ren ERR_MINIMALIF         ERR_TAPSCRIPT_MINIMALIF
ren ERR_UNKNOWN_PUBKEY    ERR_PUBKEYTYPE
ren ERR_STACK_EMPTY       ERR_INVALID_STACK_OPERATION
ren ERR_SIGOPS_RATIO      ERR_TAPSCRIPT_VALIDATION_WEIGHT
ren ERR_UNDECODABLE       ERR_BAD_OPCODE
ren ERR_NO_SUCCESS        ERR_EVAL_FALSE
ren ERR_EMPTY_WITNESS     ERR_WITNESS_PROGRAM_WITNESS_EMPTY

-END VERIFY SCRIPT-
2025-05-03 20:32:13 +02:00
Ava Chow
eba5f9c4b6 Merge bitcoin/bitcoin#32403: test: remove Boost SIGCHLD workaround.
3add6ab9ad test: remove Boost SIGCHLD workaround. (fanquake)

Pull request description:

  The related code was removed from Boost in 2e3bd1025d.

ACKs for top commit:
  achow101:
    ACK 3add6ab9ad
  laanwj:
    ACK 3add6ab9ad
  hebasto:
    ACK 3add6ab9ad, I have reviewed the code and it looks OK.
  mabu44:
    ACK 3add6ab9ad

Tree-SHA512: a0db2bb4e6a476c920a97183bd807e800d935114ff28f8802373a08b5330df42a9be953e7ea6e3c09f2ed45175f60c26c33bb4e25010269e6e491f12867ba008
2025-05-02 14:10:23 -07:00
fanquake
e1f543823b build: replace header checks with __has_include
See https://en.cppreference.com/w/cpp/preprocessor/include.
2025-05-02 16:41:04 +01:00
fanquake
3add6ab9ad test: remove Boost SIGCHLD workaround.
The related code was removed from Boost in
2e3bd1025d.
2025-05-02 10:59:46 +01:00
Tomás Andróil
cd95c9d6a7 subprocess: check and handle fcntl(F_GETFD) failure
Add missing error check for fcntl(fd, F_GETFD, 0) in set_clo_on_exec.
Raise OSError on failure to align with existing FD_SETFD behavior.
This improves robustness in subprocess setup and error visibility.

Github-Pull: arun11299/cpp-subprocess#117
Rebased-From: 9974ff69cdd5fc1a2722cb63f006df9308628b35
2025-05-01 22:16:11 +01:00
Haowen Liu
b7288decdf subprocess: Proper implementation of wait() on Windows
This commit makes sure:
1. WaitForSingleObject returns with expected
code before proceeding.
2. Process handle is properly closed.

Github-Pull: arun11299/cpp-subprocess#116
Rebased-From: 625a8775791e62736f20f3fa3e6cc4f1b24aa89a
2025-05-01 22:15:57 +01:00
Hennadii Stepanov
7423214d8d subprocess: Do not escape double quotes for command line arguments on Windows
* refactor: Guard `util::quote_argument()` with `#ifdef __USING_WINDOWS__`

The `util::quote_argument()` function is specific to Windows and is used
in code already guarded by `#ifdef __USING_WINDOWS__`.

* Do not escape double quotes for command line arguments on Windows

This change fixes the handling of double quotes and aligns the behavior
with Python's `Popen` class. For example:
```
>py -3
>>> import subprocess
>>> p = subprocess.Popen("cmd.exe /c dir \"C:\\Program Files\"", stdout=subprocess.PIPE, text=True)
>>> print(f"Captured stdout:\n{stdout}")
```

Currently, the same command line processed by the `quote_argument()`
function looks like `cmd.exe /c dir "\"C:\Program" "Files\""`, which is
broken.

With this change, it looks correct: `cmd.exe /c dir "C:\Program Files"`.

Github-Pull: arun11299/cpp-subprocess#113
Rebased-From: ed313971c04ac10dc006104aba07d016ffc6542a
2025-05-01 22:15:19 +01:00
Shunsuke Shimizu
bb9ffea53f subprocess: Explicitly define move constructor of Streams class
This suppresses the following warning caused by clang-20.

```
error: definition of implicit copy constructor for 'Streams' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
```

Copy constructor or move constructor is called when std::vector re-allocates
memory. In this case, move constructor should be called, because copying
Streams instances breaks file-descriptor management.

Communication class is modified as well, since it's instance is a member of
Streams class.

Github-Pull: arun11299/cpp-subprocess#107
Rebased-From: 38d98d9d20be50c7187b98ac9bc9a6e66920f6ef
2025-05-01 22:14:29 +01:00
Hennadii Stepanov
174bd43f2e subprocess: Avoid leaking POSIX name aliases beyond subprocess.h
The commit a32c0f3df4b6bcd1d2e93f19e8f380bb890cd507 introduced code to
silence MSVC's "warning C4996: The POSIX name for this item is
deprecated."

However, it exhibits several issues:
1. The aliases may leak into code outside the `subprocess.hpp` header.
2. They are unnecessarily applied when using the MinGW-w64 toolchain.
3. The fix is incomplete: downstream projects still see C4996 warnings.
4. The implementation lacks documentation.

This change addresses all of the above shortcomings.

Github-Pull: arun11299/cpp-subprocess#112
Rebased-From: 778543b2f2ca7f5d1c4f0241b635bbb265d750dd

Co-authored-by: Luke Dashjr <luke-jr+git@utopios.org>
2025-05-01 22:10:35 +01:00
Hennadii Stepanov
7997b7656f subprocess: Fix cross-compiling with mingw toolchain
Github-Pull: arun11299/cpp-subprocess#99
Rebased-From: 34033d03deacfdba892a708b7d8092b4d9e5e889
2025-05-01 22:07:39 +01:00
Haowen Liu
647630462f subprocess: Get Windows return code in wait()
Currently, wait() returns 0 on windows regardless
of the actual return code of processes.

Github-Pull: arun11299/cpp-subprocess#109
Rebased-From: 04b015a8e52ead4d8bb5f0eb486419c77e418a17
2025-05-01 22:07:21 +01:00
Haowen Liu
d3f511b458 subprocess: Fix string_arg when used with rref
When passing in a rvalue reference, compiler
considers it ambiguous between std::string and
std::string&&. Making one of them take a lvalue
reference makes compilers correctly pick the right
one depending on whether the passed in value binds
to a rvalue or lvalue reference.

Github-Pull: arun11299/cpp-subprocess#110
Rebased-From: 2d8a8eebb03e509840e2c3c755d1abf32d930f33
2025-05-01 22:06:28 +01:00
Haoran Peng
2fd3f2fec6 subprocess: Fix memory leaks
I encountered this issue while running my code with Valgrind today.
Below is part of the Valgrind error message:

```
==1578139== 472 bytes in 1 blocks are still reachable in loss record 1 of 1
==1578139==    at 0x4848899: malloc (...)
==1578139==    by 0x4B3AF62: fdopen@@GLIBC_2.2.5 (...)
==1578139==    by 0x118B09: subprocess::Popen::execute_process() (...)
```

I noticed that a similar fix had been proposed by another contributor
previously. I did not mean to scoop their work, but merely hoping to fix
it sooner so other people don't get confused by it just as I did today.

Github-Pull: arun11299/cpp-subprocess#106
Rebased-From: 3afe581c1f22f106d59cf54b9b65251e6c554671
2025-05-01 22:04:59 +01:00
Ava Chow
5b8046a6e8 Merge bitcoin/bitcoin#30611: validation: write chainstate to disk every hour
e976bd3045 validation: add randomness to periodic write interval (Andrew Toth)
2e2f410681 refactor: replace m_last_write with m_next_write (Andrew Toth)
b557fa7a17 refactor: rename fDoFullFlush to should_write (Andrew Toth)
d73bd9fbe4 validation: write chainstate to disk every hour (Andrew Toth)
0ad7d7abdb test: chainstate write test for periodic chainstate flush (Andrew Toth)

Pull request description:

  Since #28233, periodically writing the chainstate to disk every 24 hours does not clear the dbcache. Since #28280, periodically writing the chainstate to disk is proportional only to the amount of dirty entries in the cache. Due to these changes, it is no longer beneficial to only write the chainstate to disk every 24 hours. The periodic flush interval was necessary because every write of the chainstate would clear the dbcache. Now, we can get rid of the periodic flush interval and simply write the chainstate along with blocks and block index at least every hour.

  Three benefits of doing this:
  1. For IBD or reindex-chainstate with a combination of large dbcache setting, slow CPU, slow internet speed/unreliable peers, it could be up to 24 hours until the chainstate is persisted to disk. A power outage or crash could potentially lose up to 24 hours of progress. If there is a very large amount of dirty cache entries, writing to disk when a flush finally does occur will take a very long time. Crashing during this window of writing can cause https://github.com/bitcoin/bitcoin/issues/11600. By syncing every hour in unison with the block index we avoid this problem. Only a maximum of one hour of progress can be lost, and the window for crashing during writing is much smaller. For IBD with lower dbcache settings, faster CPU, or better internet speed/reliable peers, chainstate writes are already triggered more often than every hour so this change will have no effect on IBD.
  2. Based on discussion in #28280, writing only once every 24 hours during long running operation of a node causes IO spikes. Writing smaller chainstate changes every hour like we do with blocks and block index will reduce IO spikes.
  3. Faster shutdown speeds. All dirty chainstate entries must be persisted to disk on shutdown. If we have a lot of dirty entries, such as when close to 24 hours or if we sync with a large dbcache, it can take a long time to shutdown. By keeping the chainstate clean we avoid this problem.

  Inspired by [this comment](https://github.com/bitcoin/bitcoin/pull/28280#issuecomment-2121088705).

  Resolves https://github.com/bitcoin/bitcoin/issues/11600

ACKs for top commit:
  achow101:
    ACK e976bd3045
  davidgumberg:
    utACK e976bd3045
  sipa:
    utACK e976bd3045
  l0rinc:
    ACK  e976bd3045

Tree-SHA512: 5bccd8f1dea47f9820a3fd32fe3bb6841c0167b3d6870cc8f3f7e2368f124af1a914bca6acb06889cd7183638a8dbdbace54d3237c3683f2b567eb7355e015ee
2025-05-01 12:11:55 -07:00
merge-script
fc6346dbc8 Merge bitcoin/bitcoin#32389: doc: Fix test_bitcoin path
6cbc28b8dd doc: Fix test_bitcoin path (monlovesmango)

Pull request description:

  This commit fixes a couple command paths for interacting with the test_bitcoin binary within the Unit Test documentation.

  If the commands are run as is a `command not found` error is returned.

  ```bash
  ❯ test_bitcoin --list_content
  bash: test_bitcoin: command not found
  ```

  ```bash
  ❯ test_bitcoin --help
  bash: test_bitcoin: command not found
  ```

ACKs for top commit:
  davidgumberg:
    ACK 6cbc28b8dd

Tree-SHA512: 0b10bc3aead360fa499beef7c9715f95a9acacdda44cbfac15566428594a7a8bdece24114a42618355959e20754bedc7a903bdddbf21b819c7b75375bdc80a93
2025-05-01 10:21:31 +01:00
monlovesmango
6cbc28b8dd doc: Fix test_bitcoin path
This commit fixes a couple command paths for interacting with the
test_bitcoin binary within the Unit Test documentation.
2025-05-01 03:05:57 +00:00
Murch
85368aafa0 test: Run simple tests at various feerates 2025-04-30 15:38:04 -07:00
Murch
d610951c15 test: Recreate BnB iteration exhaustion test 2025-04-30 15:38:02 -07:00