48057 Commits

Author SHA1 Message Date
Ava Chow
083242aac8
Merge bitcoin/bitcoin#34725: fuzz: assert we accept any PSBT serialization we create
d76ec4de148724e6b384efb0a4180722ed30db10 fuzz: make sure PSBT serialization roundtrips (Antoine Poinsot)

Pull request description:

  ~~Invalid public keys were accepted in Musig2 partial signatures. Because we serialize invalid keys as the empty byte string, this would lead us to creating an invalid PSBT serializations.~~

  ~~This can be checked by reverting the first commit with the fix and simply running the target against the existing qa-assets corpus for the `psbt` harness.~~

  This patch found the issue fixed in #34219 with a single run against the existing qa-assets corpus. It is useful to make sure there are no similar bugs, and we don't introduce roundtrip regressions outside of the specifc instance of accepting invalid public keys in Musig2 fields.

  *(Edited on March 4 to only contain the fuzz harness patch)*

ACKs for top commit:
  davidgumberg:
    crACK d76ec4de14
  achow101:
    ACK d76ec4de148724e6b384efb0a4180722ed30db10
  dergoegge:
    utACK d76ec4de148724e6b384efb0a4180722ed30db10
  brunoerg:
    code review ACK d76ec4de148724e6b384efb0a4180722ed30db10

Tree-SHA512: ab5f8d4e6a1781ecdef825e1a0e2793a6b553f36c923a4a35cb1af4070eead9d9780f6cc9a76235aa03462e52a129d15e61f631490b43651dc4395f3f1c005f3
2026-03-04 13:41:10 -08:00
Ava Chow
4c40a923f0
Merge bitcoin/bitcoin#34728: test: Fix intermittent issue in wallet_assumeutxo.py
faa68ed4bdce6540f99d23c9b200ca575794a1b2 test: Fix intermittent issue in wallet_assumeutxo.py (MarcoFalke)

Pull request description:

  The test has many issues:

  * It fails intermittently, due to the use of `-stopatheight` (https://github.com/bitcoin/bitcoin/issues/34710)
  * Using `-stopatheight` is expensive, because it requires two restarts, making the test slow
  * The overwritten `def setup_network` does not store the extra args via the `add_nodes` call, so if code is added in the future to restart a node, it may not pick up its global extra args.

  Fix all issues by:

  * Adding and using a fast `dumb_sync_blocks` util helper to achieve what `-stopatheight` doesn't achieve
  * Calling `self.add_nodes(self.num_nodes, self.extra_args)` in the overridden `setup_network`

  Can be tested via this diff:

  ```diff
  diff --git a/src/node/kernel_notifications.cpp b/src/node/kernel_notifications.cpp
  index ab0e5ccb69..49384c10b8 100644
  --- a/src/node/kernel_notifications.cpp
  +++ b/src/node/kernel_notifications.cpp
  @@ -61,2 +61,3 @@ kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state
       if (m_stop_at_height && index.nHeight >= m_stop_at_height) {
  +        LogInfo("Send shutdown signal after reaching stop height");
           if (!m_shutdown_request()) {
  diff --git a/src/util/tokenpipe.cpp b/src/util/tokenpipe.cpp
  index c982fa6fc4..a5565ebd36 100644
  --- a/src/util/tokenpipe.cpp
  +++ b/src/util/tokenpipe.cpp
  @@ -4,2 +4,3 @@
   #include <util/tokenpipe.h>
  +#include <util/time.h>

  @@ -60,2 +61,3 @@ int TokenPipeEnd::TokenRead()
           ssize_t result = read(m_fd, &token, 1);
  +        UninterruptibleSleep(500ms);
           if (result < 0) {
  ```

  On master: The test fails
  On this pull: The test passes

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

ACKs for top commit:
  kevkevinpal:
    ACK [faa68ed](faa68ed4bd)
  achow101:
    ACK faa68ed4bdce6540f99d23c9b200ca575794a1b2
  w0xlt:
    ACK faa68ed4bdce6540f99d23c9b200ca575794a1b2

Tree-SHA512: 6fcd52b6f6a5fa5a5e41e7b3cf5c733af62af9c60271e7d22c266aca90f2af67f91ffe80a3ed8b8d1a91d001700870f493207998bac988c4e3671a3a0dba7ba7
2026-03-04 11:47:38 -08:00
Antoine Poinsot
d76ec4de14 fuzz: make sure PSBT serialization roundtrips
This will prevent us from creating a serialization we do not accept
going forward.
2026-03-04 11:56:02 -05:00
MarcoFalke
faa68ed4bd
test: Fix intermittent issue in wallet_assumeutxo.py 2026-03-04 17:43:15 +01:00
merge-script
e09b81638b
Merge bitcoin/bitcoin#34219: psbt: validate pubkeys in MuSig2 pubnonce/partial sig deserialization
f51665bee72c26d3f3cc6813b6c02adad5f0af6a psbt: validate pubkeys in MuSig2 pubnonce/partial sig deserialization (tboy1337)

Pull request description:

  The previous fix for invalid MuSig2 pubkeys (bitcoin/bitcoin#34010) only
  addressed the PSBT_IN_MUSIG2_PARTICIPANT_PUBKEYS field. However, the
  PSBT_IN_MUSIG2_PUB_NONCE and PSBT_IN_MUSIG2_PARTIAL_SIG fields also
  deserialize pubkeys without validation, which could lead to crashes when
  invalid pubkeys are processed.

  This commit adds validation to the DeserializeMuSig2ParticipantDataIdentifier
  function to ensure all pubkeys in MuSig2 pubnonce and partial signature
  fields are fully valid elliptic curve points.

  The fix:
  - Validates both aggregate and participant pubkeys in MuSig2 pubnonce and
    partial signature deserialization
  - Throws std::ios_base::failure with descriptive error messages for invalid
    pubkeys
  - Prevents potential crashes from invalid elliptic curve points
  - Maintains backward compatibility for valid PSBTs

  This completes the fix for issues [#33999](https://github.com/bitcoin/bitcoin/issues/33999) and [#34201](https://github.com/bitcoin/bitcoin/issues/34201).

ACKs for top commit:
  rkrux:
    lgtm ACK f51665bee72c26d3f3cc6813b6c02adad5f0af6a
  w0xlt:
    ACK f51665bee7
  darosior:
    utACK f51665bee72c26d3f3cc6813b6c02adad5f0af6a

Tree-SHA512: 8454d77a05aa003a3121b0a5975e8a000125ee0d62343bfa625a75db113358ba7a210ae0376ca1666957b7de7005e06e5a54c95170430ee5e9e1416719b8af53
2026-03-04 15:17:02 +00:00
merge-script
01dcb2fcc5
Merge bitcoin/bitcoin#34715: test: avoid interface_ipc.py race and null pointer dereference
1c1de334e9c0e3b4c72c3f3fe45b1f4df5ce4502 test: avoid interface_ipc.py race and null pointer dereference (Ryan Ofsky)

Pull request description:

  Avoid race condition in `run_deprecated_mining_test` caused by creating and immediately destroying an unused worker thread. This is leading to test failures reported by maflcko in #34711

ACKs for top commit:
  optout21:
    utACK 1c1de334e9c0e3b4c72c3f3fe45b1f4df5ce4502
  l0rinc:
    Tested ACK 1c1de334e9c0e3b4c72c3f3fe45b1f4df5ce4502
  w0xlt:
    ACK 1c1de334e9c0e3b4c72c3f3fe45b1f4df5ce4502
  enirox001:
    ACK 1c1de33

Tree-SHA512: d0af9676a46e991a3f4fda3795c02d1998d30de24991436b8ada425585c6699ff32a7057ca7a0ef2925f782fd3bf73e0381f5d4325e4f1c09f487fce1de49e45
2026-03-04 13:47:03 +00:00
merge-script
dc109e1b34
Merge bitcoin/bitcoin#34706: doc: Improve dependencies.md IPC documentation
b87a1c27c99821cea995112114eb40afa93417f2 doc: Improve dependencies.md IPC documentation (Ryan Ofsky)

Pull request description:

  Improve dependencies.md to document IPC dependencies better ([preview](https://github.com/ryanofsky/bitcoin/blob/pr/ipc-depdoc/doc/dependencies.md#build-1)). Specific changes are listed in the commit message.

  This PR is based on #33623 by willcl-ark which made similar changes in the 29.x branch. This PR could also be backported to 30.x (it merges cleanly, and master and 30.x both have the same version requirements).

ACKs for top commit:
  l0rinc:
    ACK b87a1c27c99821cea995112114eb40afa93417f2
  sedited:
    ACK b87a1c27c99821cea995112114eb40afa93417f2

Tree-SHA512: 566b5372d189f0ad04f978ddefbd8c200dcc19b25af02c73275c5faf7529943680ec59703bda11640cf7920466b4cdd46305cac4d3770e2303de37694ae78909
2026-03-04 13:31:14 +00:00
merge-script
2eaf701bc0
Merge bitcoin/bitcoin#34679: ci: Download script_assets_test.json for Windows CI
fa7612f2536b0ef47334105cf657879cdcc3a579 ci: Download script_assets_test.json for Windows CI (MarcoFalke)
7777a13306babd17e6c5956b2efb7c7886e8fc7c test: Move Fetching-print to download_from_url util (MarcoFalke)
faf96286ce69937d141d06f2a71b9fce3a5b89aa test: move-only download_from_url to stand-alone util file (MarcoFalke)
fa0cc1c5a4a760280afd7942fc3b554d1781eb09 test: [doc] Remove outdated comment (MarcoFalke)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/34670 by adding a new `download_script_assets` Python helper and calling it.

ACKs for top commit:
  hebasto:
    re-ACK fa7612f2536b0ef47334105cf657879cdcc3a579.
  janb84:
    re ACK fa7612f2536b0ef47334105cf657879cdcc3a579
  hodlinator:
    utACK fa7612f2536b0ef47334105cf657879cdcc3a579

Tree-SHA512: 73c2cb3a31f231174566fb880b82de92734b1679ef000f8d793d774b7e5f5a7b8c7994a3998ca78821115bdc80c16aada69cf596e92c083cf9b9a95c7cee16ea
2026-03-04 10:39:47 +00:00
Hennadii Stepanov
17a04039bc
Merge bitcoin/bitcoin#34662: ci: use LLVM/Clang 22 in tidy job
5e35a9069d655419cada6070e1f00a28d4a877f9 interpreter: remove clang-tidy suppression (fanquake)
4089682f5cfecd04b8d983be5f82d00c0c418bf4 ci: use Clang 22 in tidy task (fanquake)
7ea076f996dee27a640b8b18b2b58be8011dfe6e tidy: remove deprecated header (fanquake)
eb17f29aa5791136af0be5d5554d41ce34a53aa5 tidy: clang-tidy is required (fanquake)

Pull request description:

  Changes needed for moving to Clang 22 in the tidy job.

ACKs for top commit:
  maflcko:
    lgtm ACK 5e35a9069d655419cada6070e1f00a28d4a877f9
  hebasto:
    ACK 5e35a9069d655419cada6070e1f00a28d4a877f9, I have reviewed the code and it looks OK.

Tree-SHA512: 9ca6e841f7480b8abd78d5621d08a5bf80c2ff4facd7a0d76038ac1771bbf3d37dc2df19fa27583679177e4618db6294e2f2bb2129d9c25a53338b49ed71aac2
2026-03-03 22:40:05 +00:00
fanquake
5e35a9069d
interpreter: remove clang-tidy suppression 2026-03-03 17:04:56 +00:00
fanquake
4089682f5c
ci: use Clang 22 in tidy task
Added -config-file as otherwise run-clang-tidy no-longer seemed able to
find the config file.
2026-03-03 17:04:56 +00:00
fanquake
7ea076f996
tidy: remove deprecated header
```bash
   15 | #warning The ClangTidyModuleRegistry.h header is deprecated and will be removed in LLVM 24. All of the symbols it used to define have been moved into ClangTidyModule.h.
      |  ^~~~~~~
[100%] Linking CXX shared module libbitcoin-tidy.so
```
2026-03-03 17:04:55 +00:00
fanquake
eb17f29aa5
tidy: clang-tidy is required
Otherwise this check will "pass", like:
```bash
-- Detecting CXX compile features - done
-- Found LLVM 21.1.8
-- Found clang-tidy: CLANG_TIDY_EXE-NOTFOUND
-- Configuring done (0.5s)
```
2026-03-03 17:04:55 +00:00
merge-script
bf9ef4f043
Merge bitcoin/bitcoin#34422: Update libmultiprocess subtree to be more stable with rust IPC client
8fe91f37194edcca1b7dfdd06bd0d4f5b2154e9b test: Updates needed after bitcoin-core/libmultiprocess#240 (Ryan Ofsky)
b7ca3bf061b51108d155283c1ad503c0af7eab0d Squashed 'src/ipc/libmultiprocess/' changes from 1fc65008f7d..1868a84451f (Ryan Ofsky)
1fea3bae5cabc2cd3105bfc277f219454698b00a ipc, test: Add tests for unclean disconnect and thread busy behavior (Ryan Ofsky)

Pull request description:

  Includes:

  - https://github.com/bitcoin-core/libmultiprocess/pull/241
  - https://github.com/bitcoin-core/libmultiprocess/pull/240
  - https://github.com/bitcoin-core/libmultiprocess/pull/244
  - https://github.com/bitcoin-core/libmultiprocess/pull/245

  The main change is https://github.com/bitcoin-core/libmultiprocess/pull/240 which fixes issues with asynchronous requests (https://github.com/bitcoin/bitcoin/issues/33923) and unclean disconnects (https://github.com/bitcoin/bitcoin/issues/34250) that happen with the rust mining client. It also adds tests for these fixes which had some previous review in #34284 (that PR was closed to simplify dependencies between PRs).

  The changes can be verified by running `test/lint/git-subtree-check.sh src/ipc/libmultiprocess` as described in [developer notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#subtrees) and [lint instructions](https://github.com/bitcoin/bitcoin/tree/master/test/lint#git-subtree-checksh)

  Resolves #33923 and #34250

ACKs for top commit:
  Sjors:
    re-ACK 8fe91f37194edcca1b7dfdd06bd0d4f5b2154e9b
  janb84:
    reACK 8fe91f37194edcca1b7dfdd06bd0d4f5b2154e9b
  Eunovo:
    ACK 8fe91f3719

Tree-SHA512: 7e8923610502ebd8603bbea703f82178ab9e956874d394da3451f5268afda2b964d0eeb399a74d49c4123e728a14c27c0296118577a6063ff03b2b8203a257ce
2026-03-03 17:03:56 +00:00
merge-script
2702711c3a
Merge bitcoin/bitcoin#34642: wallet: call SyncWithValidationInterfaceQueue after disconnecting chain notifications
98e8af4bb991fd8edeb15c0fb8afa66bff6b5cac wallet: Drain validation interface queue after notifications disconnect (Ava Chow)
52992ebe1c55c8f7219b824f05d22fbc18acb794 interfaces: Add waitForNotifications() to call SyncWithValidationInterfaceQueue() (Ava Chow)

Pull request description:

  When the wallet disconnects chain notifications, it is expecting no further notifications to execute, but this is not the case. This results in test failures such as in #34354. Instead of disconnecting the notifications and continuing shutdown, we should wait for the validation interface queue to be drained before the rest of wallet shutdown. This is achieved by adding an `interfaces::Chain::waitForNotifications()` function which calls `SyncWithValidationInterfaceQueue()`.

  Fixes #34354

ACKs for top commit:
  stickies-v:
    utACK 98e8af4bb991fd8edeb15c0fb8afa66bff6b5cac
  furszy:
    ACK 98e8af4bb991fd8edeb15c0fb8afa66bff6b5cac
  rkrux:
    crACK 98e8af4bb991fd8edeb15c0fb8afa66bff6b5cac
  sedited:
    ACK 98e8af4bb991fd8edeb15c0fb8afa66bff6b5cac

Tree-SHA512: 263628556f740cb633d3970c22a0dfdb52a644bd1d0cd5a69c2970524edbb0e25d592cb39fc9bf1d0c281eebce09578526e2958dffee9026fc7473db35bd0dec
2026-03-02 22:00:53 +01:00
Ryan Ofsky
1c1de334e9 test: avoid interface_ipc.py race and null pointer dereference
Avoid race condition in run_deprecated_mining_test caused by creating and
immediately destroying an unused worker thread. This leads to test failures
reported by maflcko in #34711
2026-03-02 14:22:05 -05:00
Ava Chow
6b0a980de9
Merge bitcoin/bitcoin#34410: test: let connections happen in any order in p2p_private_broadcast.py
da7f70a5322843b70f29456a8bc2227209a0718b test: use port 0 for I2P addresses in p2p_private_broadcast.py (Vasil Dimov)
a8ebcfd34c63f142064b4f5ef7d52299739d4cd6 test: let connections happen in any order in p2p_private_broadcast.py (Vasil Dimov)
67696b207f370e902c8d5fb765e4ff10f6c9e1b4 net: extend log message to include attempted connection type (Vasil Dimov)

Pull request description:

  If the following two events happen:

  * (likely) the automatic 10 initial connections are not made to all
    networks
  * (unlikely) the network-specific logic kicks in almost immediately.
    It is using exponential distribution with a mean of 5 minutes
    (`rng.rand_exp_duration(EXTRA_NETWORK_PEER_INTERVAL)`).

  So if both happen, then the 11th connection may not be the expected
  private broadcast, but a network-specific connection.

  Fix this by retrieving the connection type from
  `destinations_factory()`. This is more flexible because it allows
  connections to happen in any order and does not break if e.g. the 11th
  connection is not the expected first private broadcast.

  This also makes the test run faster:
  before: 19-44 sec
  now: 10-25 sec
  because for example there is no need to wait for the initial 10
  automatic outbound connections to be made in order to proceed.

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

ACKs for top commit:
  achow101:
    ACK da7f70a5322843b70f29456a8bc2227209a0718b
  andrewtoth:
    ACK da7f70a5322843b70f29456a8bc2227209a0718b
  mzumsande:
    Code Review ACK da7f70a5322843b70f29456a8bc2227209a0718b

Tree-SHA512: 7c293e59c15c148a438e0119343b05eb278205640658c99336d4caf4848c5bae92b48e15f325fa616cbc9d5f394649abfa02406a76e802cffbd3d312a22a6885
2026-03-02 07:47:53 -08:00
Ryan Ofsky
b87a1c27c9 doc: Improve dependencies.md IPC documentation
Improve dependencies.md to document IPC dependencies better:

- Link to native_capnp.mk file not capnp.mk file so it's possible to see what
  version of Cap'n Proto is being used in release binaries. This is important
  since #31895 dropped the "Version Used" column and the capnp.mk file does not
  include version number.
- Indicate Capn"Proto is used for IPC and link to multiprocess.md documenting
  the feature.
- Link to correct PR requiring Cap'n Proto 0.7.1. Previous link was
  pointing at PR which required 0.7.0.
- Mention libmultiprocess as a dependency even though it is included as a git
  subtree and can be built as a cmake subproject. Libmultiprocess still needs
  to be built separately when cross compiling, and is useful to build separately
  when developing, and is still a depends package.

Based on 2cf352fd8e6a77003e38d954b6c879b20d4b960a from #33623 by willcl-ark
which made similar changes in the 29.x branch.
2026-03-01 12:31:59 -05:00
Ava Chow
9cad97f6cd
Merge bitcoin/bitcoin#34690: test: Add missing timeout_factor to zmq socket
fa48f8c8655d93e78b32b560a870577909b666d3 test: Add missing timeout_factor to zmq socket (MarcoFalke)

Pull request description:

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

  Otherwise, the test may intermittently fail on slow CI systems that have `--timeout-factor=` properly set.

  It can be tested by running `./bld-cmake/test/functional/interface_zmq.py --timeout-factor=10` with this diff:

  ```diff
  diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp
  index c7be6abc3a..b14cf2aee6 100644
  --- a/src/validationinterface.cpp
  +++ b/src/validationinterface.cpp
  @@ -166,2 +166,3 @@ void ValidationSignals::SyncWithValidationInterfaceQueue()
               LOG_EVENT(fmt, local_name, __VA_ARGS__);           \
  +            UninterruptibleSleep(45ms); \
               event();                                           \
  diff --git a/test/functional/interface_zmq.py b/test/functional/interface_zmq.py
  index 6717007626..eee377daea 100755
  --- a/test/functional/interface_zmq.py
  +++ b/test/functional/interface_zmq.py
  @@ -176,3 +176,3 @@ class ZMQTest (BitcoinTestFramework):
           for sub in subscribers:
  -            sub.socket.set(zmq.RCVTIMEO, recv_timeout*1000)
  +            sub.socket.set(zmq.RCVTIMEO, int(recv_timeout * 1000))

  @@ -271,3 +271,3 @@ class ZMQTest (BitcoinTestFramework):
               [(topic, address) for topic in ["hashblock", "hashtx"]],
  -            recv_timeout=2)  # 2 second timeout to check end of notifications
  +            recv_timeout=0.2)  # 2 second timeout to check end of notifications
           self.disconnect_nodes(0, 1)
  ```

  Before this pull: Test fails with `zmq.error.Again: Resource temporarily unavailable`

  After this pull: Test passes

ACKs for top commit:
  l0rinc:
    code review ACK fa48f8c8655d93e78b32b560a870577909b666d3
  achow101:
    ACK fa48f8c8655d93e78b32b560a870577909b666d3

Tree-SHA512: 5ff8bdd807ff4b644daa634bb7b469da3da3915f58afba63a90e662df99cbebc86636e34e2b1b313c8629773aef2a239fb3025226a84d2ec22f6ecd4cea666c4
2026-02-27 15:26:08 -08:00
Ava Chow
5a6dd7c693
Merge bitcoin/bitcoin#34661: ipc mining: Prevent `Assertion m_node.chainman' failed`` errors on early startup
bbc8f1e0a7e5739f15b2e646a4ace338083309a3 ipc mining: Prevent ``Assertion `m_node.chainman' failed`` errors on early startup (Ryan Ofsky)
a7cabf92e4de83c87f6b9274ddd2fb70712d29f8 init refactor: Only initialize node.notifications one time (Ryan Ofsky)
c8e332cb33594cc307cdf89b6036a0e95c238cd8 init refactor: Remove node.init accesss in AppInitInterfaces (Ryan Ofsky)

Pull request description:

  This fixes ``Assertion `m_node.chainman' failed`` errors first reported https://github.com/bitcoin/bitcoin/issues/33994#issuecomment-3602551596 when IPC mining methods are called before ChainstateManager is loaded.

  The fix works by making the `Init.makeMining` method wait until chainstate data is loaded. It's probably the simplest possible fix but other alternatives like moving the wait to `Mining.createNewBlock` were discussed in the thread https://github.com/bitcoin/bitcoin/pull/34661#discussion_r2848176298 and could be implemented later without changes to clients.

ACKs for top commit:
  Sjors:
    utACK bbc8f1e0a7e5739f15b2e646a4ace338083309a3
  ismaelsadeeq:
    ACK bbc8f1e0a7e5739f15b2e646a4ace338083309a3
  achow101:
    ACK bbc8f1e0a7e5739f15b2e646a4ace338083309a3

Tree-SHA512: 3e2e4e28ccff364b2303efd06ce337a229c28609076638500acb29559f716a15ad99409c6970ce9ad91776d53e3f9d959f1bbbd144ea9a4a2fb578ddbf2da267
2026-02-27 15:07:57 -08:00
Ava Chow
98e8af4bb9 wallet: Drain validation interface queue after notifications disconnect
When unloading a wallet, there may be unexecuted callbacks in the
validation interface queue that can still execute after we have
completed all of the other wallet shutdown tasks. Instead of letting
these run in the background, once the notifications are disconnected,
wait for the queue to drain before continuing with wallet shutdown.
2026-02-27 12:16:35 -08:00
Ava Chow
52992ebe1c interfaces: Add waitForNotifications() to call SyncWithValidationInterfaceQueue()
Co-Authored-By: stickies-v <stickies-v@protonmail.com>
2026-02-27 12:16:35 -08:00
merge-script
ceff6771b8
Merge bitcoin/bitcoin#34583: ci: [refactor] Drop last use of pwsh
fa36adeb719b5d2a6ce8e1b69d3bbd8e2bd70349 ci: [refactor] Drop last use of pwsh (MarcoFalke)
fae31b1e2f1ed35b70a0bb855f37279e448c4ec2 ci: [refactor] Move github_import_vs_env to python script (MarcoFalke)

Pull request description:

  The use of pwsh was a bit confusing and inconsistent around the exit code. See also https://github.com/bitcoin/bitcoin/pull/32672

  I think it is fine to drop it and purely use Bash/Python.

  This also moves a bit of code from the github yaml to the python script.

ACKs for top commit:
  m3dwards:
    Looks good! re-ACK fa36adeb71
  hodlinator:
    re-ACK fa36adeb719b5d2a6ce8e1b69d3bbd8e2bd70349

Tree-SHA512: 78edffc60c58c476b0acca5224150169d154b0b818114844a04295af9ba19b7cdf1fb2afb738f6cafd6172f0f477d546018ebf95061eb5bd8bbb35e065a129d4
2026-02-27 15:58:47 +00:00
merge-script
b0833b560a
Merge bitcoin/bitcoin#34668: test: Add missing resolve() to valgrind.supp file for test shell
fab51e470e738944dfc832926b05019e8b70f8c6 test: Move valgrind.supp to the other sanitizer_suppressions files (MarcoFalke)
fa9cf81d39e1354e4239933a053f6c91a6727fec test: Add missing resolve() to valgrind.supp file (MarcoFalke)

Pull request description:

  (see commit message for details)

  Can be tested via:

  ```
  ./bld-cmake/test/functional/feature_framework_testshell.py --valgrind
  ```

  Before:

  ```
  bitcoind exited with status 1 during initialization. ==1735813== FATAL: can't open suppressions file "/b-c/b-c-2/bld-cmake/contrib/valgrind.supp"
  ```

  After: (passes)

  Also, move the suppression file to all the other suppression files.

ACKs for top commit:
  frankomosh:
    Re-ACK fab51e470e738944dfc832926b05019e8b70f8c6

Tree-SHA512: d3e3e130c0e2292ca3ab9e80d2ebec6b4edc7914280ed90fb4af8a65cd1c9edd19064d86375a6787b864925fe0e47bab2321f89b9be8d1613a0aebf4ec2443fe
2026-02-27 15:47:14 +00:00
MarcoFalke
fa48f8c865
test: Add missing timeout_factor to zmq socket 2026-02-27 14:02:04 +01:00
merge-script
3a8b4e89f6
Merge bitcoin/bitcoin#34687: ci: Set TEST_RUNNER_PORT_MIN in test-each after cirrus runner switch
fa18be2f2ba19d5d35cb8a04fd4e1a7c4fc441ce test: Fix typo (MarcoFalke)
fac932698f6539e9ac4a13df51194bcb60d5d933 ci: Set TEST_RUNNER_PORT_MIN in test-each after cirrus runner switch (MarcoFalke)

Pull request description:

  This is needed after the recent switch to cirrus runners in the task in commit c8c9c1e61759f689615a304254fed33cda7f895e.

  Otherwise, the CI will fail:

  ```
   node1 stderr Error: Unable to bind to 127.0.0.1:12321 on this computer. Bitcoin Core is probably already running.
  ```

  (https://github.com/bitcoin/bitcoin/actions/runs/22398358349/job/64837827234?pr=31723#step:9:2605)

  Also, include a random second commit, so that the CI task is run in this pull.

ACKs for top commit:
  l0rinc:
    ACK fa18be2f2ba19d5d35cb8a04fd4e1a7c4fc441ce
  willcl-ark:
    ACK fa18be2f2ba19d5d35cb8a04fd4e1a7c4fc441ce

Tree-SHA512: 6b63f645bf62d3e951ca155cddf3dc562b7ce675ccae4f9179e2202679685b5c147844eb350bd219b173fe2bb976376d0caa073d3e827a48c13aa015f4745b2c
2026-02-27 12:15:12 +00:00
merge-script
286de1e7b3
Merge bitcoin/bitcoin#34093: netif: fix compilation warning in QueryDefaultGatewayImpl()
c1361fc42dd60606fcd6273cede1083cd88866a2 netif: fix compilation warning in QueryDefaultGatewayImpl() (MarcoFalke)

Pull request description:

  ```
  src/common/netif.cpp:137:51: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'unsigned long' [-Werror,-Wsign-compare]
    137 |         for (nlmsghdr* hdr = (nlmsghdr*)response; NLMSG_OK(hdr, recv_result); hdr = NLMSG_NEXT(hdr, recv_result)) {
        |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/include/netlink/netlink.h:220:31: note: expanded from macro 'NLMSG_OK'
    220 | #define NLMSG_OK(_hdr, _len)            NL_ITEM_OK(_hdr, _len, NLMSG_HDRLEN, _NLMSG_LEN)
        |                                         ^                ~~~~  ~~~~~~~~~~~~
  /usr/include/netlink/netlink.h:203:10: note: expanded from macro 'NL_ITEM_OK'
    203 |         ((_len) >= _hlen && _LEN_M(_ptr) >= _hlen && _LEN_M(_ptr) <= (_len))
        |           ~~~~  ^  ~~~~~
  1 error generated.
  ```

  Happens on FreeBSD 15.0, with the default compiler (Clang 19).

  On FreeBSD 14, `/usr/include/netlink/netlink.h` contains:
  ```
   #define NLMSG_HDRLEN                    ((int)sizeof(struct nlmsghdr))
  ```

  On FreeBSD 15, `/usr/include/netlink/netlink.h` contains:
  ```
   #define NLMSG_HDRLEN                    (sizeof(struct nlmsghdr))
  ```

ACKs for top commit:
  maflcko:
    lgtm ACK c1361fc42dd60606fcd6273cede1083cd88866a2
  hebasto:
    ACK c1361fc42dd60606fcd6273cede1083cd88866a2.

Tree-SHA512: f8f00e2106fdf91550ab388a65bb8408fcf8c4557da9614e2e1dd90e70fc010dff72bfabbbec4315335afdedb546f7b554f5c98133c5aa1d3077c5641d94b956
2026-02-27 11:59:03 +00:00
MarcoFalke
fab51e470e
test: Move valgrind.supp to the other sanitizer_suppressions files 2026-02-27 12:27:49 +01:00
MarcoFalke
fa9cf81d39
test: Add missing resolve() to valgrind.supp file
Normally, when a symlinked test script is executed directly (e.g.,
`./bld-cmake/test/functional/wallet_disable.py`), Python's default
behavior is to resolve the symlink of the script itself, setting
`sys.path[0]` to the directory containing the physical source file.
Consequently, the test framework util.py is imported from the source
tree, and `Path(__file__).parents[3]` correctly resolves to the source
root.

However, `feature_framework_testshell.py` is unique because it manually
inserts `Path(__file__).parent` into `sys.path`. That refers to the
build tree and when importing the test framework util.py, the
`Path(__file__).parents[3]` will incorrectly point to the build
directory instead of the source root.

Use `.resolve()` to ensure the Valgrind suppressions file path is always
calculated relative to the physical source file, regardless of how the
framework was imported.
2026-02-27 12:27:42 +01:00
merge-script
05cd3b00b9
Merge bitcoin/bitcoin#34597: util: Fix UB in SetStdinEcho when ENOTTY
fa6af856341384e4a84c5674e66fe7c1f13dd73c refactor: Use static_cast<decltype(...)> to suppress integer sanitizer warning (MarcoFalke)
fa692974ac2d69e01091f03625cd8a227e310065 util: Fix UB in SetStdinEcho when ENOTTY (MarcoFalke)

Pull request description:

  The call to `tcgetattr` may fail with `ENOTTY`, leaving the struct possibly uninitialized (UB).

  Fix this UB by returning early when `isatty` fails, or when `tcgetattr` fails. (Same for Windows)

  This can be tested by a command that fails valgrind before the change and passes after:

  ```
  echo 'pipe' | valgrind --quiet ./bld-cmake/bin/bitcoin-cli -stdinrpcpass uptime

ACKs for top commit:
  achow101:
    ACK fa6af856341384e4a84c5674e66fe7c1f13dd73c
  l0rinc:
    lightly tested code review ACK fa6af856341384e4a84c5674e66fe7c1f13dd73c
  sedited:
    ACK fa6af856341384e4a84c5674e66fe7c1f13dd73c

Tree-SHA512: 76e2fbcb6c323b17736ee057dbd5e932b2e8cbb7d9fe4488c1dc7ab6ea928a3cde7e72ca0a63f8c8c78871ccb8b669263b712c0e1b530d88f2d45ea41f071201
2026-02-27 10:41:23 +00:00
merge-script
3c7b0f97e0
Merge bitcoin/bitcoin#34656: doc: clarify confusing git range-diff add/delete output
45133c589a970390bc10e4db4f7d9921dbaa0832 doc: clarify `git range-diff` add/delete output (Lőrinc)

Pull request description:

  ### Problem
  Range diffs in git are useful after PR rebases, but it has an easy-to-misread failure mode: if it cannot match a commit between the old and new ranges, it will show the old commit as removed (<) and the new commit as added (>), without showing any patch contents for that commit.
  It can look like there were no code changes when in reality the commit was just treated as unrelated and needs full re-review.

  ### Example

  ```bash
  git fetch upstream ff338fdb53a66ab40a36e1277e7371941fc89840 dd76338a57b9b1169ac27f7b783d6d0d4c6e38ab
  git range-diff ff338fdb53a6...dd76338a57b9
  ```

  This produced output like:
  ```patch
  1:  0ca4295f2e = 93:  139aa4b27e bench: add on-disk `HaveInputs` benchmark
  2:  4b32181dbb <  -:  ---------- test: add `HaveInputs` call-path unit tests
  -:  ---------- > 94:  277c57f0c5 test: add `HaveInputs` call-path unit tests
  3:  8c57687f86 ! 95:  c0c94ec986 dbwrapper: have `Read` and `Exists` reuse `ReadRaw`
  @@ Metadata
  ## Commit message ##
     dbwrapper: have `Read` and `Exists` reuse `ReadRaw`

  -    `ExistsImpl` was removed since it duplicates `CDBWrapper::ReadImpl` (except that it copies the resulting string on success, but that will be needed for caching anyway).
  +    `ExistsImpl` was removed since it duplicates `CDBWrapper::ReadImpl`.
  ```

  Even though the subject matches, there is no diff shown because the commits did not match - the reviewer could think that only the commit message was changed.
  This should be treated as **unmatched** rather than **unchanged**.
  If you expected a match, you can try increasing the search effort:
  ```bash
  git range-diff --creation-factor=95 ff338fdb53a6...dd76338a57b9
  ```
  which would show for example:
  ```patch
  1:  0ca4295f2e = 93:  139aa4b27e bench: add on-disk `HaveInputs` benchmark
  2:  4b32181dbb ! 94:  277c57f0c5 test: add `HaveInputs` call-path unit tests
  @@ Commit message

       The tests document that `HaveInputs()` consults the cache first and that a cache miss pulls from the backing view via `GetCoin()`.

  +    Co-authored-by: Novo <eunovo9@gmail.com>
  +
    ## src/test/coins_tests.cpp ##
   @@ src/test/coins_tests.cpp: BOOST_FIXTURE_TEST_CASE(ccoins_flush_behavior, FlushTest)
        }
    }

  -+BOOST_AUTO_TEST_CASE(ccoins_haveinputs_cache_miss_uses_base_getcoin)
  ++BOOST_AUTO_TEST_CASE(ccoins_cache_behavior)
  ```

  ### Fix
  This PR updates `doc/productivity.md` to raise awareness and document this pitfall and mentions `--creation-factor` as a knob to try when the output seems unexpectedly empty.

ACKs for top commit:
  maflcko:
    review ACK 45133c589a970390bc10e4db4f7d9921dbaa0832 🏦
  Sjors:
    ACK 45133c589a970390bc10e4db4f7d9921dbaa0832
  rkrux:
    crACK 45133c5
  sedited:
    ACK 45133c589a970390bc10e4db4f7d9921dbaa0832

Tree-SHA512: 52dcf6db51425a3ac9789627f80233fb1e3437f7a351acf4a761504d9917837aa1ff8c964605a842ee099fae9842946784f7603f9bffa7051429b2f04b7900be
2026-02-27 10:21:39 +00:00
Hennadii Stepanov
701b8d7148
Merge bitcoin/bitcoin#34609: test: remove appveyor reference in comment
8834e4e86c851c4eb01a7e978cdbde5b3cbd24cc test: remove appveyor reference in comment (Max Edwards)

Pull request description:

  Appveyor is not longer used however the test still requires to check for permissions including 666 as otherwise the tests fail on Windows

  Fixes: #32576

ACKs for top commit:
  maflcko:
    lgtm ACK 8834e4e86c851c4eb01a7e978cdbde5b3cbd24cc
  hebasto:
    ACK 8834e4e86c851c4eb01a7e978cdbde5b3cbd24cc.

Tree-SHA512: 655b44e52da5e0c6c11c79bb4f92c701c6e0e66dce8d7791ccf1d64e4561fe4d1d5f37c1317bead89c88e4d7208a278925168b419482a6be17abf93d0ebc5dfa
2026-02-27 09:28:17 +00:00
MarcoFalke
fa18be2f2b
test: Fix typo 2026-02-27 09:21:45 +01:00
MarcoFalke
fac932698f
ci: Set TEST_RUNNER_PORT_MIN in test-each after cirrus runner switch 2026-02-27 09:19:11 +01:00
MarcoFalke
c1361fc42d
netif: fix compilation warning in QueryDefaultGatewayImpl()
```
src/common/netif.cpp:137:51: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'unsigned long' [-Werror,-Wsign-compare]
  137 |         for (nlmsghdr* hdr = (nlmsghdr*)response; NLMSG_OK(hdr, recv_result); hdr = NLMSG_NEXT(hdr, recv_result)) {
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netlink/netlink.h:220:31: note: expanded from macro 'NLMSG_OK'
  220 | #define NLMSG_OK(_hdr, _len)            NL_ITEM_OK(_hdr, _len, NLMSG_HDRLEN, _NLMSG_LEN)
      |                                         ^                ~~~~  ~~~~~~~~~~~~
/usr/include/netlink/netlink.h:203:10: note: expanded from macro 'NL_ITEM_OK'
  203 |         ((_len) >= _hlen && _LEN_M(_ptr) >= _hlen && _LEN_M(_ptr) <= (_len))
      |           ~~~~  ^  ~~~~~
1 error generated.
```

Happens on FreeBSD 15.0, with the default compiler (Clang 19).

On FreeBSD 14, `/usr/include/netlink/netlink.h` contains:
```
 #define NLMSG_HDRLEN                    ((int)sizeof(struct nlmsghdr))
```

On FreeBSD 15, `/usr/include/netlink/netlink.h` contains:
```
 #define NLMSG_HDRLEN                    (sizeof(struct nlmsghdr))
```

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2026-02-27 05:48:06 +01:00
Ava Chow
b6b8f8ac55
Merge bitcoin/bitcoin#34562: ThreadPool follow-ups, proactive shutdown and HasReason dependency cleanup
408d5b12e80151feded31c2a5509e2dc5f15edf3 test: include response body in non-JSON HTTP error msg (Matthew Zipkin)
9dc653b3b4f3049b0e742499b762f7c13bb006cc test: threadpool, add coverage for all Submit() errors (furszy)
ce2a984ee324d37ba1dd7c2c4e27e40e0508bedc test: cleanup, use HasReason in threadpool_tests.cpp (l0rinc)
d9c6769d0324b65121935b7c8a285c6421fe74a6 test: refactor, decouple HasReason from test framework machinery (furszy)
dbbb780af02d850a1f9257f18610cfb9de9cb828 test: move and simplify BOOST_CHECK ostream helpers (Hodlinator)
3b7cbcafcb9b318bf1fa00a3499f514c5ebe9bb6 test: ensure Stop() thread helps drain the queue (seduless)
ca101a2315774f0ed65da633ba99899fd0dad740 test: coverage for queued tasks completion after interrupt (furszy)
bf2c607aaa22d253b9367c11b0a198bd4244ad2f threadpool: active-wait during shutdown (furszy)
e88d2744301a434064714f0a21e1395d41ac3984 test: add threadpool Start-Stop race coverage (furszy)
8cd4a4363fb85f5487a19ace82aa0d12d5fab450 threadpool: guard against Start-Stop race (furszy)
9ff1e82e7dbdf31ddf1c534853da4581a1f41bd5 test: cleanup, block threads via semaphore instead of shared_future (l0rinc)

Pull request description:

  A few follow-ups to #33689, includes:

  1) `ThreadPool` active-wait during shutdown:
  Instead of just waiting for workers to finish processing tasks, `Stop()` now helps them actively.
  This speeds up the JSON-RPC and REST server shutdown, resulting in a faster node shutdown when many requests remain unhandled. This wasn't included in the original PR due to the behavior change this introduces.

  2) Decouple `HasReason` from the unit test framework machinery
  This avoids providing the entire unit test framework dependency to low-level tests that only require access to the `HasReason` utility class. Examples are: `reverselock_tests.cpp`, `sync_tests.cpp`, `util_check_tests.cpp`, `util_string_tests.cpp`, `script_parse_tests.cpp` and `threadpool_tests.cpp`. These tests no longer gain access to unnecessary components like the chainstate, node context, caches, etc. It includes l0rinc's `threadpool_tests.cpp` `HasReason` changes.

  3) Include response body in non-JSON HTTP error messages
  Straight from pinheadmz [comment](https://github.com/bitcoin/bitcoin/pull/33689#discussion_r2783817192), it makes debugging CI issues easier.

ACKs for top commit:
  maflcko:
    review ACK 408d5b12e80151feded31c2a5509e2dc5f15edf3 🕗
  achow101:
    ACK 408d5b12e80151feded31c2a5509e2dc5f15edf3
  hodlinator:
    re-ACK 408d5b12e80151feded31c2a5509e2dc5f15edf3

Tree-SHA512: 57aa0ef96886f32bf95a0bd7f87c878d31c9df9e34cb96de615eee703ce0824b5cfdf8f5c9cd19a3594559994295b5810c38c94f5efd6291cbbd83a95473357a
2026-02-26 12:44:11 -08:00
Max Edwards
8834e4e86c test: remove appveyor reference in comment
Appveyor is not longer used however the test still requires to check for
permissions including 666 as otherwise the tests fail on Windows
2026-02-26 17:32:34 +00:00
MarcoFalke
fa7612f253
ci: Download script_assets_test.json for Windows CI 2026-02-26 17:59:34 +01:00
merge-script
bb3ac00cf8
Merge bitcoin/bitcoin#34001: test: fix test_limit_enforcement_package
0a8d303d667cc10a68fd15d799039b9ae26c3315 test: fix test_limit_enforcement_package (Greg Sanders)

Pull request description:

  The current test has a couple issues:

  1) the parent_tx_good is regenerating the exact same transaction that is already in the cluster, so it's resulting in no replacements on submission
  2) once fixed, the additional fee needs to be allocated to the parent transaction in the package, not the child. If the RBF fees are allocated to the child, this triggers the package RBF logic, which requires no in-mempool ancestors to be present.

  Fix the bug and add a few assertions to protect against regressions.

ACKs for top commit:
  bensig:
    ACK 0a8d303d667cc10a68fd15d799039b9ae26c3315
  achow101:
    ACK 0a8d303d667cc10a68fd15d799039b9ae26c3315
  sipa:
    ACK 0a8d303d667cc10a68fd15d799039b9ae26c3315

Tree-SHA512: 0ba184d82edc5a502e9119a6876e80c4564c876fa51ee39293d47bd30c18bf3ded50fbd2f6f2a3394784fad05d8f6370a90682068b30358b077280abd2477252
2026-02-26 16:14:32 +00:00
Hennadii Stepanov
107a204d24
Merge bitcoin/bitcoin#34682: ci: fix vcpkg tools cache key collision between windows matrix jobs
17a079c2fb96c44f25d6392389db22a7f424f8f1 ci: fix vcpkg tools cache key collision between windows matrix jobs (will)

Pull request description:

  The standard and fuzz matrix jobs share the same github.job value
  (windows-native-dll), so both try to save the vcpkg tools cache with the
  same key.

  Since the tools are identical across build types, let them share a
  single cache entry by restricting the save to the standard job only.

ACKs for top commit:
  maflcko:
    lgtm ACK 17a079c2fb96c44f25d6392389db22a7f424f8f1
  hebasto:
    ACK 17a079c2fb96c44f25d6392389db22a7f424f8f1, this should fix issues like https://github.com/bitcoin/bitcoin/pull/34559#issuecomment-3897330307.

Tree-SHA512: 2e83846bfc88947b4bc321baa23563e0c093cd4f55f11f8105c2ecf867b78028aa71aa4780f928103b7a9f1f2e3cf72dbb072f05e7925bc1d00069234acf23c9
2026-02-26 15:59:19 +00:00
MarcoFalke
7777a13306
test: Move Fetching-print to download_from_url util
This does not change any behavior.
2026-02-26 16:55:54 +01:00
MarcoFalke
faf96286ce
test: move-only download_from_url to stand-alone util file
Can be reviewed via --color-moved=dimmed-zebra
2026-02-26 16:55:48 +01:00
will
17a079c2fb
ci: fix vcpkg tools cache key collision between windows matrix jobs
The standard and fuzz matrix jobs share the same github.job value
(windows-native-dll), so both try to save the vcpkg tools cache with the
same key.

Since the tools are identical across build types, let them share a
single cache entry by restricting the save to the standard job only.
2026-02-26 14:58:52 +00:00
Matthew Zipkin
408d5b12e8
test: include response body in non-JSON HTTP error msg
Useful for debugging issues.

Co-authored-by: Matias Furszyfer <matiasfurszyfer@protonmail.com>
2026-02-26 11:28:55 -03:00
furszy
9dc653b3b4
test: threadpool, add coverage for all Submit() errors
Submit tasks to a non-started, interrupted, or stopped
pool and verify the proper error is always returned.
2026-02-26 11:28:55 -03:00
l0rinc
ce2a984ee3
test: cleanup, use HasReason in threadpool_tests.cpp 2026-02-26 11:28:55 -03:00
furszy
d9c6769d03
test: refactor, decouple HasReason from test framework machinery
Avoid providing the entire unit test framework dependency to tests that only
require access to the HasReason utility class.

E.g. reverselock_tests.cpp, sync_tests.cpp, util_check_tests.cpp, util_string_tests.cpp,
and script_parse_tests.cpp only require access to HasReason and nothing else.
2026-02-26 11:28:55 -03:00
Hodlinator
dbbb780af0
test: move and simplify BOOST_CHECK ostream helpers
Move the operator<< overloads used by BOOST_CHECK_* out of the
unit test machinery test/setup_common, into test/util/common.h.

And replace the individual per-type ToString() overloads with
a single concept-constrained template that covers any type
exposing a ToString() method. This is important to not add
uint256.h and transaction_identifier.h dependencies to the
shared test/util/common.h file.

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
2026-02-26 11:28:55 -03:00
seduless
3b7cbcafcb
test: ensure Stop() thread helps drain the queue
Exercise the case where tasks remain pending and verify that the
thread calling Stop() participates in draining the queue
2026-02-26 11:16:11 -03:00
furszy
ca101a2315
test: coverage for queued tasks completion after interrupt 2026-02-26 11:15:52 -03:00