Commit Graph

47818 Commits

Author SHA1 Message Date
Pieter Wuille
d69c9f56ea clusterlin: count chunk deps without loop (optimization)
This small optimization avoids the need to loop over the parents of each
transaction when initializing the dependency-counting structures inside
GetLinearization().
2026-02-17 09:04:36 -05:00
Pieter Wuille
f66fa69ce0 clusterlin: split tx/chunk dep counting (preparation)
This splits the chunk_deps variable in LoadLinearization in two, one for
tracking tx dependencies and one for chunk dependencies. This is a
preparation for a later commit, where chunks won't be identified anymore
by a representative transaction in them, but by a separate index. With
that, it seems weird to keep them both in the same structure if they
will be indexed in an unrelated way.

Note that the changes in src/test/util/cluster_linearize.h to the table
of worst observed iteration counts are due to switching to a different
data set, and are unrelated to the changes in this commit.
2026-02-17 09:04:36 -05:00
Pieter Wuille
900e459778 clusterlin: avoid depgraph argument in SanityCheck (cleanup)
Since the deterministic ordering change, SpanningForestState holds a
reference to the DepGraph it is linearizing. So this means we do not
need to pass it to SanityCheck() as an argument anymore.
2026-02-17 09:04:36 -05:00
Pieter Wuille
666b37970f clusterlin: fix type to count dependencies 2026-02-17 09:04:36 -05:00
merge-script
a7c29df0e5 Merge bitcoin/bitcoin#34552: fees: refactor: separate feerate format from fee estimate mode
c1355493e2 refactor: fees: split fee rate format from fee estimate mode (ismaelsadeeq)
922ebf96ed refactor: move-only: move `FeeEstimateMode` enum to `util/fees.h` (ismaelsadeeq)

Pull request description:

  ### Motivation

  Part of #34075

  - The `FeeEstimateMode` enum was responsible for both selecting the fee estimation algorithm and specifying the fee rate' format.

  ####  Changes in this PR:
     * The `FeeEstimateMode` enum (`UNSET`, `ECONOMICAL`, `CONSERVATIVE`) is moved to a new util/fees.h header.
     * A new `FeeRateFormat `enum (`BTC_KVB`, `SAT_VB`) is introduced in `policy/feerate.h` for feerate formatting.
     * The `CFeeRate::ToString()` method is updated to use `FeeRateFormat`.
     * All relevant function calls have been updated to use the new `FeeRateFormat` enum for formatting and `FeeEstimateMode` for fee estimation mode.

   This refactoring separates these unrelated responsibilities to improve code clarity.

ACKs for top commit:
  l0rinc:
    ACK c1355493e2
  furszy:
    utACK c1355493e2
  musaHaruna:
    ACK [c135549](c1355493e2) — reviewed in the context of PR [34075](https://github.com/bitcoin/bitcoin/pull/34075)
  willcl-ark:
    ACK c1355493e2

Tree-SHA512: 7cbe36350744313d3d688d3fd282a58c441af1818b1e8ad9cddbc911c499a5205f8d4a39c36b21fed60542db1ef763eb69752d141bcef3393bf33c0922018645
2026-02-17 14:15:38 +01:00
merge-script
c8c9c1e617 Merge bitcoin/bitcoin#34383: ci: remove commit count limit from test-each-commit and fail fast
eb510f8678 ci: fail fast in test-each-commit script (Lőrinc)
04c4d71008 ci: remove commit count limit from `test-each-commit` (Lőrinc)

Pull request description:

  ### Problem

  `test-each-commit` currently tests only a limited number of ancestor commits in a PR, so failures introduced deeper in the commit stack might be missed.

  ### Fix

  Remove the max-count limit so `test-each-commit` runs the full build + unit + functional test flow on every non-head PR commit, while keeping the PR tip excluded because it is already covered by the normal CI jobs.
  It will also stop after the first failure to surface the root cause sooner and keep logs readable when testing ancestor commits.

  ### Examples
  * Example failure 10 commits deep: https://github.com/l0rinc/bitcoin/actions/runs/21390976651/job/61577575033?pr=105 in https://github.com/l0rinc/bitcoin/pull/105
  * Example pass with >7 dummy commits: https://github.com/l0rinc/bitcoin/actions/runs/21392557521/job/61595159841?pr=106 in https://github.com/l0rinc/bitcoin/pull/106

  ---------

  Note: this PR has gone through a few iterations, the latest one just extends the existing job.

ACKs for top commit:
  maflcko:
    lgtm ACK eb510f8678 🕓
  hebasto:
    re-ACK eb510f8678.
  willcl-ark:
    ACK eb510f8678

Tree-SHA512: 5aadafd32daad610ce882277802c390642dc34f7d5bfa71d4b503ee007942d1ebafce2a3430ea5fd2af6673c83f9aee42450043be4722d7c02407d90920f8bce
2026-02-17 10:03:37 +00:00
merge-script
8a050b9cb6 Merge bitcoin/bitcoin#34575: test: Avoid empty errmsg in JSONRPCException
211111b804 test: Avoid empty errmsg in JSONRPCException (MarcoFalke)

Pull request description:

  It is unclear why the fallback should be an empty message, when it is better to include all rpc_error details that are available.

  Also, include the http status.

  This allows to revert commit 6354b4fd7f, because it is no longer needed.

  Can be tested by running this diff:

  ```diff
  diff --git a/test/functional/wallet_disable.py b/test/functional/wallet_disable.py
  index dbcccd4778..9717a2d248 100755
  --- a/test/functional/wallet_disable.py
  +++ b/test/functional/wallet_disable.py
  @@ -18,9 +18,8 @@ class DisableWalletTest (BitcoinTestFramework):
           self.extra_args = [["-disablewallet"]]
           self.wallet_names = []

  -    def run_test (self):
  -        # Make sure wallet is really disabled
  -        assert_raises_rpc_error(-32601, 'Method not found', self.nodes[0].getwalletinfo)
  +    def run_test(self):
  +        self.nodes[0].getwalletinfo()
           x = self.nodes[0].validateaddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
           assert x['isvalid'] == False
           x = self.nodes[0].validateaddress('mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ')

ACKs for top commit:
  ismaelsadeeq:
    utACK 211111b804
  furszy:
    utACK 211111b804
  hodlinator:
    ACK 211111b804
  rkrux:
    tACK 211111b804

Tree-SHA512: 92067aaaa61a887398e38f587004ba31070acc6a9dbd003e9e35393e8c049e786177afa43da05d2d653af340b6c69803c4323061d73d417219bcdf37729e4b66
2026-02-17 09:40:06 +00:00
Hennadii Stepanov
35e6444fdc Merge bitcoin/bitcoin#34570: doc: update Windows MSVC build guide to utilize winget to install build requirements
d159b10398 doc: update Windows MSVC build guide to utilize WinGet to install apps (janb84)

Pull request description:

  This PR updates the Windows MSVC build guide to bring it more in line with the macOS and Unix build guides.

  Currently the guide listed requirements but left users to manually do the download/installation. The macOS and the Unix guide utilize package managers to provide concrete installation commands that users can follow. By introducing  `winget`, the Windows MSVC build guide now also provides concrete installation commands.

  The changes/commands can be tested on any windows machine, provided it run a  Windows 10 (version 1809 (build 17763)) or later (e.g. Windows 11 / Server 2025).

ACKs for top commit:
  hodlinator:
    re-ACK d159b10398
  hebasto:
    re-ACK d159b10398.

Tree-SHA512: 9eeee60ba3e50e42362f1a6d8003120868c1f49cf146cc6fe16a6deb53ce29c67e841b8ec80d516fe2e6d6ea4c48d34fb12691151e0fea5568c14377bd3da6fb
2026-02-16 13:42:33 +00:00
janb84
d159b10398 doc: update Windows MSVC build guide to utilize WinGet to install apps 2026-02-16 14:26:52 +01:00
MarcoFalke
211111b804 test: Avoid empty errmsg in JSONRPCException
It is unclear why the fallback should be an empty message, when it is
better to include all rpc_error details that are available.

Also, include the http status.

This allows to revert commit 6354b4fd7f,
because it is no longer needed.
2026-02-13 18:55:53 +01:00
Hennadii Stepanov
b65ff0e5a1 Merge bitcoin/bitcoin#34548: ci: Add and use ci-windows-cross.py helper
fa13b13239 ci: [refactor] Use pathlib over os.path (MarcoFalke)
fa2719ab1b ci: [refactor] Move run_unit_tests to ci-windows-cross.py (MarcoFalke)
fa99ba5f14 ci: Set PREVIOUS_RELEASES_DIR env var in ci-windows-cross.py (MarcoFalke)
fa4a1cab6c ci: Move run_functional_tests into ci-windows-cross.py (MarcoFalke)
1111108685 ci: [refactor] Move pyzmq install and get_previous_releases into ci-windows-cross.py (MarcoFalke)
fac9c7bd66 ci: [refactor] Move config.ini rewrite to ci-windows-cross.py (MarcoFalke)
faf7389466 ci: Move check_manifests step to ci-windows-cross.py (MarcoFalke)
fa674d55df ci: [refactor] Move print_version step into ci-windows-cross.py helper (MarcoFalke)

Pull request description:

  Currently the ci yaml has a mix of Bash and Pwsh snippets, which is problematic:

  * The `shellcheck` tool does not review the Bash
  * The ci yaml is not merged with master on re-runs, but the code is, leading to possibly confusing CI errors on re-runs
  * The Pwsh isn't reviewed at all by any tool
  * It is tedious to run the CI commands locally on Windows

  Fix all issues by extracting them into a step-based Python script.

ACKs for top commit:
  janb84:
    re ACK fa13b13239
  hebasto:
    ACK fa13b13239, I have reviewed the code and it looks OK.

Tree-SHA512: 23d21d3bfb07e102fe1cc15ba5749d553d9766ae6c4a7648bd77df0705469bd138c76a9a2fdeb4d91d3f889a425b7caf25878ecb2e68b604faf9665f8df4eb6d
2026-02-13 14:31:35 +00:00
merge-script
03e5f063b5 Merge bitcoin/bitcoin#34559: ci: split vcpkg tools cache into restore/save
c413cf12c5 ci: Split vcpkg tools cache into restore/save (willcl-ark)

Pull request description:

  The vcpkg tools cache was using the combined actions/cache action, which by default saves on every run regardless of branch. Split it into the restore/save pattern used by the other caches, so that saves only happen on default branch pushes.

  This will have little impact in bitcoin/bitcoin (which uses few branches), but on forks, if you don't update master branch frequently (which saves all caches), then all cache space will eventually be taken up by multiple vckpg tools caches, resulting in bad cache hit rates in all other jobs.

ACKs for top commit:
  maflcko:
    lgtm ACK c413cf12c5

Tree-SHA512: e28a43b1aa17ce7f0a19d16b98efed0372004d83e4d7e92a126f642599d7e1a94684032a48a3b380b3a7c970c313c92bfe30146b977e33f81b45fe70b49755e3
2026-02-13 11:34:49 +00:00
merge-script
84e826ddc1 Merge bitcoin/bitcoin#34511: test: fully reset the state of CConnman in tests
2cb7e99dee test: also reset CConnman::m_private_broadcast in tests (Vasil Dimov)
91b7c874e2 test: add ConnmanTestMsg convenience method Reset() (Vasil Dimov)

Pull request description:

  Member variables of `CConnman::m_private_broadcast` (introduced in
  https://github.com/bitcoin/bitcoin/pull/29415) could influence the tests
  which creates non-determinism if the same instance of `CConnman` is used
  for repeated test iterations.

  So, reset the state of `CConnman::m_private_broadcast` from
  `ConnmanTestMsg::Reset()`. Currently this affects the fuzz tests
  `process_message` and `process_messages`.

  Reported in https://github.com/bitcoin/bitcoin/issues/34476#issuecomment-3849088794

ACKs for top commit:
  maflcko:
    review ACK 2cb7e99dee 🚙
  Crypt-iQ:
    tACK 2cb7e99dee
  frankomosh:
    Code Review ACK 2cb7e99dee
  brunoerg:
    code review ACK 2cb7e99dee

Tree-SHA512: 0f4b114542da8dc611689457ce67034c15cbfe409b006b2db72bc74078ee9513f5ce3d0e6e67d37c127cfa0a5170fe72fe3ea45ce2a61d45a358dd11bd1881f8
2026-02-13 11:17:26 +00:00
merge-script
309c51d89d Merge bitcoin/bitcoin#34546: kernel: Avoid duplicating symbols in the kernel library
eafd530d20 kernel: avoid potential duplicate object in shared library/binary (Cory Fields)
24c3b47010 build: add kernel-specific warnings (Cory Fields)

Pull request description:

  This is a revival of https://github.com/bitcoin/bitcoin/pull/31807

  Introduces the [-Wunique-object-duplication](https://clang.llvm.org/docs/DiagnosticsReference.html#wunique-object-duplication) warning flag available in clang-21 for usage when building the kernel library. It warns of potential duplicate objects in shared libraries. REDUCE_EXPORTS needs to be ON to trigger it.

  Though we have a C API now that manages exporting symbols, I think it is prudent to also avoid any duplicate symbols on the internal c++ side in case we ever to decide to expose some of its headers. It also not clear that all linkers would handle these cases correctly even in the current internal usage.

ACKs for top commit:
  fanquake:
    ACK eafd530d20
  hebasto:
    ACK eafd530d20.

Tree-SHA512: 81961b50f0268dbe076497e130857f5b4b9151c748d107ec15158d1511dd25bce745e0beeb127b9cea51cb2edd78032735600606a75f7ff8a3fd572acced42e0
2026-02-13 11:11:14 +00:00
Cory Fields
eafd530d20 kernel: avoid potential duplicate object in shared library/binary
Fixes warning and potential bug whereby init_flag may exist in both
libbitcoinkernel as well as a downstream user, as opposed to being shared as
intended.

src/support/lockedpool.h:224:31:
warning: 'init_flag' may be duplicated when built into a shared library: it is mutable, has hidden visibility, and external linkage [-Wunique-object-duplication]
2026-02-13 08:50:50 +01:00
Cory Fields
24c3b47010 build: add kernel-specific warnings
In some cases, we'll want to be more aggressive or care about different things
when building the kernel. In this case, a warning is added for symbols which
may be duplicated between the kernel and downstream users.

This warning was introduced in clang 21, which is not yet the minimum
supported compiler version. REDUCE_EXPORTS needs to be ON to trigger it.
2026-02-13 08:50:17 +01:00
merge-script
07b924775e Merge bitcoin/bitcoin#34427: lint: Flatten lint image entry points
faba426b3b lint: Flatten lint image entry points (MarcoFalke)
1111fff91c lint: Add missing --platform=linux to docker build command (MarcoFalke)

Pull request description:

  Two fixups to the lint container:

  * Add a missing `--platform=linux` to avoid running a non-native arch, like s390x, which happens with podman if such a container was most recently used.
  * Flatten the entry points to remove the bash-based one:

  Previously, an additional entry point into the container that spawned a bash was supported. The bash had an alias `lint` to run all lint scripts. However, such a use-case seems limited (because it only runs inside the container), inflexible (because it only allows running all lint scripts), and possibly brittle (because it can miss re-building the image when the cache is stale). So remove it and just offer the single entry point via the `./ci/lint.py` script.

  If there is a use-case to skip the image building, it should be trivial to add an env var setting the the lint Python script like `DANGER_SKIP_IMAGE_RE_BUILD=1` (or so) in the future.

ACKs for top commit:
  willcl-ark:
    ACK faba426b3b

Tree-SHA512: 9afda16723c215602c6c42fa3a286d1828c887c8f6ff9512c8ec162ec8997789695f0c464d389cae94e67acf8b5e0f1a55e2ee0d60131a2eee091cf281f91514
2026-02-12 09:43:29 +00:00
Ryan Ofsky
0b4cd08fcd Merge bitcoin/bitcoin#33965: mining: fix -blockreservedweight shadows IPC option
b623fab1ba mining: enforce minimum reserved weight for IPC (Sjors Provoost)
d3e49528d4 mining: fix -blockreservedweight shadows IPC option (Sjors Provoost)
418b7995dd test: have mining template helpers return None (Sjors Provoost)

Pull request description:

  Also enforce `MINIMUM_BLOCK_RESERVED_WEIGHT` for IPC clients.

  The `-blockreservedweight` startup option should only affect RPC code, because IPC clients (currently) do not have a way to signal their intent to use the node default (the `BlockCreateOptions` struct defaults merely document a recommendation for client software).

  Before this PR however, if the user set `-blockreservedweight` then `ApplyArgsManOptions` would cause the `block_reserved_weight` option passed by IPC clients to be ignored. _Users who don't set this value were not affected._

  Fix this by making BlockCreateOptions::block_reserved_weight an std::optional.

  Internal interface users, such as the RPC call sites, don't set a value so -blockreservedweight is used. Whereas IPC clients do set a value which is no longer ignored.

  Test coverage is added, with a preliminary commit that refactors the `create_block_template` and `wait_next_template` helpers.

  `mining_basic.py` already ensured `-blockreservedweight` is enforced by mining RPC methods. The second commit adds coverage for Mining interface IPC clients. It also verifies that `-blockreservedweight` has no effect on them.

  The third commit enforces `MINIMUM_BLOCK_RESERVED_WEIGHT` for IPC clients. Previously lower values were quietly clamped.

  ---

  Merge order preference: #34452 should ideally go first.

ACKs for top commit:
  sedited:
    Re-ACK b623fab1ba
  ryanofsky:
    Code review ACK b623fab1ba. Was rebased and test split up and comment updated since last review.
  ismaelsadeeq:
    ACK b623fab1ba

Tree-SHA512: 9e651a520d8e4aeadb330da86788744b6ecad8060fa21d50dc8e6012a60083e7b262aaa08a64676b9ef18ba65b651bc1272d8383d184030342e4c0f2c6a9866d
2026-02-11 21:22:28 -05:00
merge-script
55c49ff8f4 Merge bitcoin/bitcoin#34143: build: Prevent system header fallback and include path pollution
65134c7e5f depends: Prefix include path for headers-only `systemtap` package (Hennadii Stepanov)
94a692b6aa cmake: Add missed `USDT::headers` (Hennadii Stepanov)
b5375c44ed depends: Prefix include path for headers-only `boost` package (Hennadii Stepanov)
d73378ffcc cmake: Add missed `Boost::headers` (Hennadii Stepanov)

Pull request description:

  Currently, header-only dependencies in the depends subsystem are installed into the standard `include/` subdirectory. This inadvertently exposes their headers to the compiler via `-I` flags brought in by other dependencies (e.g., `libevent` or `sqlite`). This "include path pollution" masks missing dependencies in the build configuration. While the build might succeed by accident due to this overlap, it creates a fragile state. If the overlapping library is removed, the build will break, or, worse, the compiler may silently fall back to the host system's default paths (e.g., `/usr/include`).

  This PR improves build system security and hygiene by enforcing strict, distinguished include paths for header-only dependencies. The missing dependencies revealed by this change (`Boost::headers`, `USDT::headers`) have been fixed in separate commits.

ACKs for top commit:
  theuni:
    re-ACK 65134c7e5f
  fanquake:
    ACK 65134c7e5f

Tree-SHA512: 41667b46c3bd2f872951a5651b30f7d1468f49f1265196b7868233ed44b2eb0e33f1f69a1af348b55f07a8d1f594e276eb49b724e80b8eae85aed1c9bacae197
2026-02-11 17:43:10 +00:00
merge-script
c134b1a4bc Merge bitcoin/bitcoin#34257: txgraph: deterministic optimal transaction order
6f113cb184 txgraph: use fallback order to sort chunks (feature) (Pieter Wuille)
0a3351947e txgraph: use fallback order when linearizing (feature) (Pieter Wuille)
fba004a3df txgraph: pass fallback_order to TxGraph (preparation) (Pieter Wuille)
941c432a46 txgraph test: subclass TxGraph::Ref like mempool does (preparation) (Pieter Wuille)
39d0052cbf clusterlin: make optimal linearizations deterministic (feature) (Pieter Wuille)
8bfbba3207 txgraph: sort distinct-cluster chunks by equal-feerate-prefix size (feature) (Pieter Wuille)
e0bc73ba92 clusterlin: sort tx in chunk by feerate and size (feature) (Pieter Wuille)
6c1bcb2c7c txgraph: clear cluster's chunk index in ~Ref (preparation) (Pieter Wuille)
7427c7d098 txgraph: update chunk index on Compact (preparation) (Pieter Wuille)
3ddafceb9a txgraph: initialize Ref in AddTransaction (preparation) (Pieter Wuille)

Pull request description:

  Part of #30289.

  TxGraph's fundamental responsibility is deciding the order of transactions in the mempool. It relies on the `cluster_linearize.h` code to optimize it, but there can and often will be many different orderings that are essentially equivalent from a quality perspective, so we have to pick one. At a high level, the solution will involve one or more of:
  * Deciding based on **internal identifiers** (`Cluster::m_sequence`, `DepGraphIndex`). This is very simple, but risks leaking information about transaction receive order.
  * Deciding **randomly**, which is private, but may interfere with relay expectations, block propagation, and ability to monitor network behavior.
  * Deciding **based on txid**, which is private and deterministic, but risks incentivizing grinding to get an edge (though we haven't really seen such behavior).
  * Deciding **based on size** (e.g. prefer smaller transactions), which is somewhat related to quality, but not unconditionally (depending on mempool layout, the ideal ordering might call for smaller transactions first, last, or anywhere in between). It's also not a strong ordering as there can be many identically-sized transactions. However, if it were to encourage grinding behavior, incentivizing smaller transactions is probably not a bad thing.

  As of #32545, the current behavior is primarily picking randomly, though inconsistently, as some code paths also use internal identifiers and size. #33335 sought to change it to use random (preferring size in a few places), with the downsides listed above.

  This PR is an alternative to that, which changes the order to tie-break based on size everywhere possible, and use lowest-txid-first as final fallback. This is fully deterministic: for any given set of mempool transactions, if all linearized optimally, the transaction order exposed by TxGraph is deterministic.

  The transactions within a chunk are sorted according to:
  1. `PostLinearize` (which improves sub-chunk order), using an initial linearization created using the rules 2-5 below.
  2. Topology (parents before children).
  3. Individual transaction feerate (high to low)
  4. Individual transaction weight (small to large)
  5. Txid (low to high txid)

  The chunks within a cluster are sorted according to:
  1. Topology (chunks after their dependencies)
  2. Chunk feerate (high to low)
  3. Chunk weight (small to large)
  4. Max-txid (chunk with lowest maximum-txid first)

  The chunks across clusters are sorted according to:
  1. Feerate (high to low)
  2. Equal-feerate-chunk-prefix weight (small to large)
  3. Max-txid (chunk with lowest maximum-txid first)

  The equal-feerate-chunk-prefix weight of a chunk C is defined as the sum of the weights of all chunks in the same cluster as C, with the same feerate as C, up to and including C itself, in linearization order (but excluding such chunks that appear after C). This is a well-defined approximation of sorting chunks from small to large across clusters, while remaining consistent with intra-cluster linearization order.

ACKs for top commit:
  ajtowns:
    reACK 6f113cb184 it was good before and now it's better
  instagibbs:
    ACK 6f113cb184
  marcofleon:
    light crACK 6f113cb184

Tree-SHA512: 16dc43c62b7e83c81db1ee14c01e068ae2f06c1ffaa0898837d87271fa7179dd98baeb74abc9fe79220e01fdba6876defe60022c2b72badc21d770644a0fe0ac
2026-02-11 17:40:38 +00:00
merge-script
4a05825a3f Merge bitcoin/bitcoin#33689: http: replace WorkQueue and single threads handling for ThreadPool
38fd85c676 http: replace WorkQueue and threads handling for ThreadPool (furszy)
c323f882ed fuzz: add test case for threadpool (TheCharlatan)
c528dd5f8c util: introduce general purpose thread pool (furszy)
6354b4fd7f tests: log node JSON-RPC errors during test setup (furszy)
45930a7941 http-server: guard against crashes from unhandled exceptions (furszy)

Pull request description:

  This has been a recent discovery; the general thread pool class created for #26966, cleanly
  integrates into the HTTP server. It simplifies init, shutdown and requests execution logic.
  Replacing code that was never unit tested for code that is properly unit and fuzz tested.
  Although our functional test framework extensively uses this RPC interface (that’s how
  we’ve been ensuring its correct behavior so far - which is not the best).

  This clearly separates the responsibilities:
  The HTTP server now focuses solely on receiving and dispatching requests, while ThreadPool handles
  concurrency, queuing, and execution.

  This will also allows us to experiment with further performance improvements at the task queuing and
  execution level, such as a lock-free structure or task prioritization or any other implementation detail
  like coroutines in the future, without having to deal with HTTP code that lives on a different layer.

  Note:
  The rationale behind introducing the ThreadPool first is to be able to easily cherry-pick it across different
  working paths. Some of the ones that are benefited from it are #26966 for the parallelization of the indexes
  initial sync, #31132 for the parallelization of the inputs fetching procedure, #32061 for the libevent replacement,
  the kernel API #30595 (https://github.com/bitcoin/bitcoin/pull/30595#discussion_r2413702370) to avoid blocking validation among others use cases not publicly available.

  Note 2:
  I could have created a wrapper around the existing code and replaced the `WorkQueue` in a subsequent
  commit, but it didn’t seem worth the extra commits and review effort. The `ThreadPool` implements
  essentially the same functionality in a more modern and cleaner way.

ACKs for top commit:
  Eunovo:
    ReACK 38fd85c676
  sedited:
    Re-ACK 38fd85c676
  pinheadmz:
    ACK 38fd85c676

Tree-SHA512: a0330e54ed504330ca874c42d4e318a909f548b2fb9ac46db8badf5935b9eec47dc4ed503d1b6f98574418e3473420ea45f60498be05545c4325cfa89dcca689
2026-02-11 18:04:17 +01:00
ismaelsadeeq
c1355493e2 refactor: fees: split fee rate format from fee estimate mode
- Introduce a `FeeRateFormat` enum and change `CFeeRate::ToString()`
   to use it for `BTC/kvB` vs `sat/vB` output formatting.
 - Handle all enum values, hence remove default case in `CFeeRate::ToString()`
   and `assert(False)` when a `FeeRateFormat` value is not handled.
 - Keep `FeeEstimateMode` focused on fee estimation behavior by removing fee rate format
   values from `FeeEstimateMode`.
 - Update all formatting call sites and tests to pass `FeeRateFormat` explicitly, separating fee rate format
   from fee-estimation mode selection.
2026-02-11 15:48:00 +00:00
willcl-ark
c413cf12c5 ci: Split vcpkg tools cache into restore/save
The vcpkg tools cache was using the combined actions/cache action,
which saves on every run regardless of branch. Split it into the
restore/save pattern used by the other caches, so that saves only
happen on default branch pushes.
2026-02-11 15:35:46 +00:00
merge-script
337fef9f2f Merge bitcoin/bitcoin#34554: build: avoid exporting secp256k1 symbols
2ccfdb582b build: avoid exporting secp256k1 symbols (Cory Fields)

Pull request description:

  Take advantage of the [new secp256k1 option to avoid visibility attributes](https://github.com/bitcoin-core/secp256k1/pull/1696) on API functions.

  While most users of a shared libsecp always want API functions exported so that they can actually be linked against, we always build it statically. When that static lib is linked into a (static or shared) libbitcoinkernel, by default its symbols end up exported there as well.

  As libsecp is an implementation detail of the kernel (and any future Core lib), its symbols should never be exported.

  [This was the intended use for the above PR](https://github.com/bitcoin-core/secp256k1/pull/1696#issuecomment-3028838988), looks like we just forgot to follow-up and actually hook it up.

  This is most easily tested by building with `-DBUILD_KERNEL_LIB=ON -DBUILD_SHARED_LIBS=ON` (with or without `-DREDUCE_EXPORTS=ON`) and inspecting via:
  ```bash
  nm -CD lib/libbitcoinkernel.so | grep secp
  ```

  Before this change, secp's symbols will show up there. After, they should be absent.

  This should finally solve secp symbol visibility once and for all :)

ACKs for top commit:
  hebasto:
    ACK 2ccfdb582b, this is implemented exactly as I [tested](https://github.com/bitcoin-core/secp256k1/pull/1696#pullrequestreview-3033584362) the upstream PR. Tested on Fedora 43.
  stickies-v:
    tACK 2ccfdb582b

Tree-SHA512: 664ea7a6f811c2743ad1b4d8913c61aab9b358931ee77895d35cdf8a5607fbb08facda085877c53d731afbf42a7220dcc752fc365a7625ee679c1547e1c674d0
2026-02-11 13:53:03 +00:00
ismaelsadeeq
922ebf96ed refactor: move-only: move FeeEstimateMode enum to util/fees.h 2026-02-11 11:38:20 +00:00
merge-script
cb1798000c Merge bitcoin/bitcoin#33861: build: Bump VS minimum supported version to 18.3
452c743951 refactor: Remove workaround for resolved MSVC bug (Hennadii Stepanov)
7164a0cab6 build: Bump VS minimum supported version to 18.3 (Hennadii Stepanov)

Pull request description:

  The new [VS 18.0](https://learn.microsoft.com/en-us/visualstudio/releases/2026/release-notes) release includes numerous bug fixes.

  Bumped to v18.3.0 where [this](https://github.com/microsoft/vcpkg/issues/22074) bug in the builtin vcpkg is [fixed](https://github.com/microsoft/vcpkg/issues/22074#issuecomment-3880320585).

ACKs for top commit:
  maflcko:
    review ACK 452c743951 🍳
  hodlinator:
    crACK 452c743951
  janb84:
    ACK 452c743951

Tree-SHA512: a8f859d11d4cf0440cf7ff8353fd1babe90818356ef02eae28571a2a4a7960db1f85cdbc4f88b5fb8a1f8bf44bca8c8715cdfb9ea87997c3fcd81866cd0b156d
2026-02-11 11:20:34 +00:00
merge-script
7640863a0f Merge bitcoin/bitcoin#34555: doc: archive release notes for v29.3
d29bc5e6dd doc: archive release notes for v29.3 (sedited)

Pull request description:

  Archive v29.3 release notes.

ACKs for top commit:
  janb84:
    ACK d29bc5e6dd

Tree-SHA512: 212b69b058856e69276b7ac9483c420891904526308983ceea0ec62c2976af92b43c218f9c72e3851cbdf9ced3bcce7a4be27e601b34bd57b9002d8953440cb5
2026-02-11 10:39:16 +00:00
sedited
d29bc5e6dd doc: archive release notes for v29.3 2026-02-11 11:27:32 +01:00
merge-script
fd625d84ae Merge bitcoin/bitcoin#34539: test: Fixup TODO comment in feature_dbcrash.py; remove unnecessary sleep
fa8c89511d Fixup TODO comment in feature_dbcrash.py; remove unnecessary sleep (MarcoFalke)

Pull request description:

  Fixup some stale comments:

  * The `60 seconds` is outdated. It should say 120 seconds. However, just clarify that there is a timeout.
  * The TODO seems to imply that a timeout (failure to restart) can happen. However, I don't think we've seen it happen. So there isn't anything to do right now. Just remove the `TODO`, but keep the advice.

  Also, remove an unnecessary `time.sleep(1)`. If there is a need for it, a comment should explain why.

ACKs for top commit:
  l0rinc:
    ACK fa8c89511d

Tree-SHA512: 5ee13b48fc4a5802f3fadb125d71118e01d2cb08ede9d310d6ed13acd8fb7b03185cad73c475c617054c4c4423156ea927a32d0e3a670c3cc13339b552dc8a5c
2026-02-11 09:25:37 +00:00
merge-script
6777314310 Merge bitcoin/bitcoin#34551: ci: Extend diff context for clang-format
f8d2f30bf3 ci: Extend diff context for clang-format (Hennadii Stepanov)

Pull request description:

  This PR ensures `clang-format` can properly restore empty lines between header groups that were previously stripped by `fix_includes.py`.

  Addresses [this](https://github.com/bitcoin/bitcoin/pull/34448#issuecomment-3876394168) comment.

ACKs for top commit:
  maflcko:
    lgtm ACK f8d2f30bf3
  l0rinc:
    untested code review ACK f8d2f30bf3
  sedited:
    ACK f8d2f30bf3

Tree-SHA512: 97e5450fc15e415134aa1e74ee415f947173978d999afbc0f204e1cdb2f68309b763c8a2ad819c4597147fc15540600aa8c99477db64e961ad428d8f45f3d384
2026-02-11 10:02:59 +01:00
Hennadii Stepanov
452c743951 refactor: Remove workaround for resolved MSVC bug
The bug was fixed in Visual Studio 18.0.
2026-02-10 23:30:39 +00:00
Hennadii Stepanov
7164a0cab6 build: Bump VS minimum supported version to 18.3 2026-02-10 23:30:23 +00:00
Cory Fields
2ccfdb582b build: avoid exporting secp256k1 symbols
Take advantage of the new secp256k1 option to avoid visibility attributes on
API functions.

While most users of a shared libsecp always want API functions exported so that
they can actually be linked against, we always build it statically. When that
static lib is linked into a (static or shared) libbitcoinkernel, by default its
symbols end up exported there as well.

As libsecp is an implementation detail of the kernel (and any future Core lib),
its symbols should never be exported.
2026-02-10 21:18:25 +00:00
MarcoFalke
fa8c89511d Fixup TODO comment in feature_dbcrash.py; remove unnecessary sleep
Co-authored-by: l0rinc <pap.lorinc@gmail.com>
2026-02-10 19:45:07 +01:00
Hennadii Stepanov
f8d2f30bf3 ci: Extend diff context for clang-format
This ensures clang-format can properly restore empty lines between
header groups that were previously stripped by fix_includes.py.
2026-02-10 17:22:37 +00:00
Hennadii Stepanov
91a8e9b549 Merge bitcoin-core/gui#807: refactor: interfaces, make 'createTransaction' less error-prone
4c0d4f6f93 refactor: interfaces, make 'createTransaction' less error-prone (furszy)
e2c3ec9bf4 refactor: move CreatedTransactionResult to types.h (furszy)
45372175c3 gui: remove AmountWithFeeExceedsBalance error special case (furszy)

Pull request description:

  Bundle all function's outputs inside the `util::Result` returned object.

  Removals:
  - The input-output 'change_pos' ref arg from `createTransaction`, which has been a source of bugs in the past.
  - The 'fee' ref arg from `createTransaction`, which is currently only set when the transaction creation process succeeds.
  - The no longer needed `AmountWithFeeExceedsBalance` error (more info about its re-introduction at [bitcoin#25269](https://github.com/bitcoin/bitcoin/pull/25269) and [bitcoin#34299](https://github.com/bitcoin/bitcoin/pull/34299).

  Additionally, this PR moves the `CreatedTransactionResult` struct into its own file. This change is made to avoid further expanding the GUI dependencies on `wallet.h`. Structurally, the GUI should only access the model/interfaces and never the wallet directly.

ACKs for top commit:
  stratospher:
    ACK 4c0d4f6.
  hebasto:
    ACK 4c0d4f6f93.

Tree-SHA512: 4fc61f08ca2e66e46001defb3a2e852265713e75006c98f0c465bd48afe42e7b0d626d28d578741906fdd26e907d6919f06dc640c55c44efc3dfa766fdbf38a4
2026-02-10 15:33:37 +00:00
MarcoFalke
fa13b13239 ci: [refactor] Use pathlib over os.path 2026-02-10 14:25:33 +01:00
MarcoFalke
fa2719ab1b ci: [refactor] Move run_unit_tests to ci-windows-cross.py 2026-02-10 14:25:31 +01:00
MarcoFalke
fa99ba5f14 ci: Set PREVIOUS_RELEASES_DIR env var in ci-windows-cross.py
This uses the workspace instead of the runner.temp, so that it is easier
to reproduce the CI locally.
2026-02-10 14:24:29 +01:00
MarcoFalke
fa4a1cab6c ci: Move run_functional_tests into ci-windows-cross.py
This is mostly a refactor, except for putting the temp dirs into
Path.cwd(), which makes running this locally easier.

Note, the use of process_cpu_count() is intentional. It was only added
in Python 3.13, according to
https://docs.python.org/3/library/os.html#os.process_cpu_count .

However, Python 3.13 is also the minimum required version on Windows,
according to
https://github.com/bitcoin/bitcoin/issues/29897#issuecomment-2940318094
to avoid intermittent test failures.
2026-02-10 14:24:02 +01:00
MarcoFalke
1111108685 ci: [refactor] Move pyzmq install and get_previous_releases into ci-windows-cross.py 2026-02-10 14:22:58 +01:00
MarcoFalke
fac9c7bd66 ci: [refactor] Move config.ini rewrite to ci-windows-cross.py 2026-02-10 14:21:54 +01:00
MarcoFalke
faf7389466 ci: Move check_manifests step to ci-windows-cross.py
This is almost a refactor. The only change is putting the
bitcoind.manifest into a different folder.
2026-02-10 11:16:53 +01:00
MarcoFalke
fa674d55df ci: [refactor] Move print_version step into ci-windows-cross.py helper 2026-02-10 10:54:55 +01:00
Pieter Wuille
6f113cb184 txgraph: use fallback order to sort chunks (feature)
This makes TxGraph also use the fallback order to decide the order of
chunks from distinct clusters.

The order of chunks across clusters becomes:
1. Feerate (high to low)
2. Equal-feerate-chunk-prefix (small to large)
3. Max-txid (chunk with lowest maximum-txid first)

This makes the full TxGraph ordering fully deterministic as long as all
clusters in it are optimally linearized.
2026-02-09 15:55:58 -05:00
Pieter Wuille
0a3351947e txgraph: use fallback order when linearizing (feature)
Add glue to make TxGraph use the fallback order provided to it, in the
fallback comparator it provides to the cluster linearization code.

The order of chunks within a cluster becomes:
1. Topology (chunks after their dependencies)
2. Feerate (high to low)
3. Weight (small to large)
4. Max-txid (chunk with lowest maximum-txid first)

The order of transactions within a chunk becomes:
1. Topology (parents before children)
2. Individual transaction feerate (high to low)
3. Weight (small to large)
4. Txid (low to high txid)

This makes optimal cluster linearization, both the order of chunks
within a chunk, and the order of transactions within those chunks,
completely deterministic.
2026-02-09 15:55:58 -05:00
Pieter Wuille
fba004a3df txgraph: pass fallback_order to TxGraph (preparation)
This adds an std::function<strong_ordering(Ref&,Ref&)> argument to the
MakeTxGraph function, which can be used by the caller (e.g., mempool
code) to provide a fallback order to TxGraph.

This is just preparation; TxGraph does not yet use this fallback order
for anything.
2026-02-09 15:55:58 -05:00
Pieter Wuille
941c432a46 txgraph test: subclass TxGraph::Ref like mempool does (preparation)
This is a small change to the txgraph fuzz test to make it used objects
derived from TxGraph::Ref (SimTxObject) rather than TxGraph::Ref
directly. This matches how the mempool uses CTxMemPoolEntry, which
derives from TxGraph::Ref.

This is preparation for a future commit which will introduce simulated
txids to the transactions in this fuzz test, to be used as fallback
order.
2026-02-09 15:55:58 -05:00
Pieter Wuille
39d0052cbf clusterlin: make optimal linearizations deterministic (feature)
This allows passing in a fallback order comparator to Linearize(), which
is used as final tiebreak when deciding the order of chunks and
transactions within a chunk, rather than a random tiebreak.

The order of transactions within a chunk becomes:
1. Topology (parents before children)
2. Individual transaction feerate (high to low)
3. Weight (small to large)
4. Fallback (low to high fallback order)

The order of chunks within a cluster becomes:
1. Topology (chunks after their dependencies)
2. Feerate (high to low)
3. Weight (small to large)
4. Max-fallback (chunk with lowest maximum-fallback-tx first)

For now, txgraph passes a naive comparator to Linearize(), which makes
the cluster order deterministic when treating the input transactions as
identified by the DepGraphIndex. However, since DepGraphIndexes are the
result of possibly-randomized operations inside txgraph, this doesn't
actually make txgraph's per-cluster ordering deterministic. That will be
changed in a later commit, by using a txid-based fallback instead.
2026-02-09 15:55:58 -05:00
Pieter Wuille
8bfbba3207 txgraph: sort distinct-cluster chunks by equal-feerate-prefix size (feature)
This makes TxGraph track the equal-feerate-prefix size of all chunks in
all clusters in the main graph, and uses it to sort chunks coming from
distinct clusters.

The order of chunks across clusters becomes:
1. Feerate (high to low)
2. Equal-feerate-prefix (small to large)
3. Cluster sequence number (old to new); this will be changed later.

The equal-feerate-prefix size of a chunk C is defined as the sum
of the weights of all chunks in the same cluster as C, with the same
feerate as C, up to and including C itself, in linearization order (but
excluding such chunks that appear after C).

This is an approximation of sorting chunks from small to large across
clusters, while remaining consistent with intra-cluster linearization
order.
2026-02-09 15:55:58 -05:00