Commit Graph

47753 Commits

Author SHA1 Message Date
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
Pieter Wuille
e0bc73ba92 clusterlin: sort tx in chunk by feerate and size (feature)
This changes the order of transactions within a chunk to be:
1. Topology (parents before children)
2. Individual transaction feerate (high to low)
3. Individual transaction weight (small to large)
4. Random tiebreak (will be changed in a future commit)

To do so, use a heap of topology-ready transactions within
GetLinearization(), sorted by (2), (3), and (4).

This is analogous to the order of chunks within a cluster, which is
unchanged:
1. Topology (chunks after chunks they depend on)
2. Chunk feerate (high to low)
3. Chunk weight (small to large)
4. Random tiebreak (will be changed in a future commit)
2026-02-09 15:55:58 -05:00
Pieter Wuille
6c1bcb2c7c txgraph: clear cluster's chunk index in ~Ref (preparation)
Whenever a TxGraph::Ref is destroyed, if it by then still appears inside
main-level clusters, wipe the chunk index entries for those clusters, to
prevent having lingering indexes for transactions without Ref.

This is preparation for enabling a callback being passed to MakeTxGraph
to define a fallback order on objects. Once the Ref for a transaction is
gone, it is not possible to invoke the callback anymore. To prevent the
index becoming inconsistent, we need to immediately get rid of the index
entries when the Ref disappears.

This is not a problem, because such destructions necessarily will
trigger a relinearization of the cluster (assuming there are
transactions in it left) before becoming acceptable again, and the chunk
ordering is not observable (through CompareMainOrder, or through the
BlockBuilder interface) until that point. However, the index itself
needs to remain consistent in the mean time, even if not meaningful.
2026-02-09 15:55:58 -05:00
Pieter Wuille
7427c7d098 txgraph: update chunk index on Compact (preparation)
This makes TxGraphImpl::Compact() invoke Cluster::Updated() on all
affected clusters, in case they have internal GraphIndex values stored
that may have become outdated with the renumbering of GraphIndex values
that Compact() caused.

No such GraphIndex values are currently stored, but this will change in
a future commit.
2026-02-09 15:55:58 -05:00
Pieter Wuille
3ddafceb9a txgraph: initialize Ref in AddTransaction (preparation)
Instead of returning a TxGraph::Ref from TxGraph::AddTransaction(),
pass in a TxGraph::Ref& which is updated to refer to the new transaction
in that graph.

This cleans up the usage somewhat, avoiding the need for dummy Refs in
CTxMemPoolEntry constructor calls, but the motivation is that a future
commit will allow a callback to passed to MakeTxGraph to define a
fallback order on the transaction objects. This does not work when a
Ref is created separately from the CTxMemPoolEntry it ends up living in,
as passing the newly-created Ref to the callback would be UB before it's
emplaced in its final CTxMemPoolEntry.
2026-02-09 15:55:55 -05:00
Hennadii Stepanov
64294c8909 Merge bitcoin/bitcoin#34500: ci: Print verbose Windows CI build failure
fa90277d22 ci: Use ubuntu-slim for [meta] runners (MarcoFalke)
fa9627af9f ci: Rely on cmake --preset toolchain file (MarcoFalke)
fa3f89acaa ci: Add check_manifests to ci-windows.py (MarcoFalke)
1111079a16 ci: Add run_tests step to ci-windows.py (MarcoFalke)
fa561682ce ci: [refactor] Add .github/ci-windows.py prepare_tests step (MarcoFalke)
fa3e607c6d ci: Print verbose Windows CI build failure (MarcoFalke)
4444808dd3 ci: [refactor] Add .github/ci-windows.py build step (MarcoFalke)
fabdd4e823 ci: Refactor Windows CI into script (MarcoFalke)

Pull request description:

  Just like all the other CI configs, the Windows one should print a single and readable build failure at the end.

  Also, includes a bunch of Windows CI refactors.

ACKs for top commit:
  m3dwards:
    ACK fa90277d22
  hebasto:
    ACK fa90277d22.
  willcl-ark:
    utACK fa90277d22

Tree-SHA512: 00443289e3d8b6d60d1347934d9d4b16098e8c36b6325467e5804b1869714201c4f7e932da3be44392c73e4713a1f52cd8af481894d36c6a281ba7238d43434e
2026-02-09 19:05:36 +00:00
merge-script
5f6bfa3649 Merge bitcoin/bitcoin#34057: test: add tests for cluster chunks
fe0b1513a7 test: add a test for txgraph staging (Hao Xu)
ef253a9d3d test: add block builder tests for txgraph (Hao Xu)
4a1ac31e97 test: add a chunk test for txgraph (Hao Xu)

Pull request description:

  Add tests for cluster chunks, including:
      - txgraph_chunk_chain test: test chunk implementation for a simple chain style graph .
      - txgraph_staging test: test the staging feature for a basic graph.

ACKs for top commit:
  instagibbs:
    reACK fe0b1513a7
  sipa:
    reACK fe0b1513a7

Tree-SHA512: 01010a3b4e4163849df2912d1393be74d26eb199d0544cfbef58a498aca5153463a118f55a2f1cad2995552b74210031e659de8df6b88cbcffdffd2a1b464990
2026-02-09 15:44:31 +00:00
merge-script
6ca7782db9 Merge bitcoin/bitcoin#34523: doc: Clarify why performance-move-const-arg.CheckTriviallyCopyableMove=false
fa88ac3f4f doc: Clarify why performance-move-const-arg.CheckTriviallyCopyableMove=false (MarcoFalke)

Pull request description:

  Without this doc, there is a risk that the setting will be turned off, see https://github.com/bitcoin/bitcoin/pull/34514.

  The reason to disable it is to catch logic bugs, even on trivially copyable types:

  ```cpp
  #include <utility>
  void Eat(int&& food) { food = 0; };
  int main() {
    int food{2};
    Eat(std::move(food));
    Eat(std::move(food));  // This should err
  }
  ```

ACKs for top commit:
  l0rinc:
    ACK fa88ac3f4f
  hebasto:
    ACK fa88ac3f4f.
  sedited:
    ACK fa88ac3f4f

Tree-SHA512: d1bda846a10190a2936084a06bd87418c6a3e4ababc298e4beb9bc9e1190bff430cbe973475d634eda5ef7863571c89bfa4b78ff63fcbd9ac10c42fd9d5fa23a
2026-02-09 13:53:51 +00:00
merge-script
44afed4cd9 Merge bitcoin/bitcoin#34524: refactor: [rpc] Remove confusing and brittle integral casts (take 2)
fa6801366d refactor: [rpc] Remove confusing and brittle integral casts (take 2) (MarcoFalke)

Pull request description:

  Second take for cases which I seem to have missed in commit 94ddc2dced.

  When constructing an UniValue from integral values, historically (long ago), in some cases casts where needed. With the current UniValue constructor, only very few are actually needed.

  Keeping the unused casts around is:

  * confusing, because code readers do not understand why they are needed
  * brittle, because some may copy them into new places, where they will lead to hard-to-find logic bugs, such as the ones fixed in pull https://github.com/bitcoin/bitcoin/pull/34112

  So fix all issues by removing them, except for a few cases, where casting was required:
  * `static_cast<bool>(fCoinBase)`, because `bool{fCoinBase}` only works on modern compilers.

  This hardening refactor does not fix any bugs and does not change any behavior.

ACKs for top commit:
  Sjors:
    ACK fa6801366d
  sedited:
    ACK fa6801366d

Tree-SHA512: 77f03f496ea2a42987720cb4a36eb4e7a0d5b512ed7f029e41dd54c04fb4c1680f7cc13514acbc9f1bae991be4de3cf31c5a0d27c016a030f5749d132603f71e
2026-02-09 13:32:28 +00:00
merge-script
3764746404 Merge bitcoin/bitcoin#34241: test: Check that interrupt results in EXIT_SUCCESS
fa16b275fa test: Check that interrupt results in EXIT_SUCCESS (MarcoFalke)
fab7c7f56c test: Split large init_stress_test into two smaller functions (MarcoFalke)

Pull request description:

  This is a test for https://github.com/bitcoin/bitcoin/pull/34224. The test can be tested by reverting that pull request and observing the test failure.

  Also, includes a small test cleanup/refactor.

ACKs for top commit:
  janb84:
    ACK fa16b275fa
  sedited:
    ACK fa16b275fa

Tree-SHA512: bb6894316fd4f78b3c0cb299cc93abf7f3f794e0507bf7deda7d86f8f45d60299ec0f027c41a6f909c197a1e5fba44fe269ce4165450b89738b82d8ddf196b80
2026-02-09 14:10:44 +01:00
merge-script
acefdce083 Merge bitcoin/bitcoin#34469: consensus/test/doc: cover errors in CheckTxInputs with unit tests
8c03318387 consensus/doc: explain `GetValueOut()` precondition (Lőrinc)
82ef92c8d0 consensus/doc: explain unreachable `bad-txns-fee-outofrange` check (Lőrinc)
232a2bce90 consensus/test: add out-of-range output unit tests for `CTransaction::GetValueOut` (Lőrinc)
aa87aae14f consensus/test: add `MoneyRange` unit tests for `CheckTxInputs` (Lőrinc)

Pull request description:

  ### Problem
  Coverage reports indicate that a few consensus related validations aren't exercised in unit-, and some not even in the functional-tests:
  Inspired by the coverage reports:
  * ["bad-txns-premature-spend-of-coinbase"](https://maflcko.github.io/b-c-cov/test_bitcoin.coverage/src/consensus/tx_verify.cpp.gcov.html#L180): Only covered in functional tests
  * ["bad-txns-inputvalues-outofrange"](https://maflcko.github.io/b-c-cov/test_bitcoin.coverage/src/consensus/tx_verify.cpp.gcov.html#L187): Unreachable in functional tests [1], uncovered in unit tests
  * ["bad-txns-in-belowout"](https://maflcko.github.io/b-c-cov/test_bitcoin.coverage/src/consensus/tx_verify.cpp.gcov.html#L193): Only covered in functional tests
  * ["GetValueOut: value out of range"](https://maflcko.github.io/b-c-cov/test_bitcoin.coverage/src/primitives/transaction.cpp.gcov.html#L103) and [total coverage report](https://maflcko.github.io/b-c-cov/total.coverage/src/primitives/transaction.cpp.gcov.html#L103)

  Replacing them with explicit throws still passes all unit (and sometimes even functional) tests, confirming those branches are not being exercised, see: https://github.com/l0rinc/bitcoin/pull/112

  ### Fixes

  Add minimal unit test coverage for `Consensus::CheckTxInputs` invalid outcomes for `bad-txns-premature-spend-of-coinbase`, `bad-txns-inputvalues-outofrange`, `bad-txns-in-belowout`.
  Add a unit test covering `CTransaction::GetValueOut()` throwing for out of range values.
  After the prerequisits are tested, document why `bad-txns-fee-outofrange` is unreachable - while keeping the check in place because it is consensus-critical code.

ACKs for top commit:
  maflcko:
     lgtm ACK 8c03318387 🍴
  darosior:
    utACK 8c03318387
  sedited:
    ACK 8c03318387

Tree-SHA512: 91c65dda99b42d12de99c58b02df0f861203f97d268329a3ecce79bd681fcaf847f508c1d9f2256b2b92a953a94d868cbae647f378def92484681d771722ea27
2026-02-09 13:13:19 +01:00
merge-script
7e5e0b20ea Merge bitcoin/bitcoin#32773: cmake: Create subdirectories in build tree in advance
76dae5d691 cmake: Replace recursive globbing with explicit globbing in folders (Hennadii Stepanov)
88d9092571 cmake: Create subdirectories in build tree in advance (Hennadii Stepanov)

Pull request description:

  While reviewing https://github.com/bitcoin/bitcoin/pull/32697, I noticed that symlink creation fails when the target subdirectory does not exist. In such cases, `file(CREATE_LINK ... COPY_ON_ERROR SYMBOLIC)` falls back to copying, which implicitly creates the required path. As a result, a single file is copied instead of symlinked for subdirectories in `test/functional`.

  This PR ensures that necessary subdirectories are created in advance, so that subsequent symlink creation does not fail due to missing paths.

  For example:
  - on the master branch:
  ```
  $ cmake -B build
  $ ls -l build/test/functional/mocks/
  total 8
  -rwxrwxr-x 1 hebasto hebasto 2683 Jul  3 14:11 invalid_signer.py
  lrwxrwxrwx 1 hebasto hebasto   64 Jul  3 14:11 multi_signers.py -> /home/hebasto/dev/bitcoin/test/functional/mocks/multi_signers.py
  lrwxrwxrwx 1 hebasto hebasto   60 Jul  3 14:11 no_signer.py -> /home/hebasto/dev/bitcoin/test/functional/mocks/no_signer.py
  lrwxrwxrwx 1 hebasto hebasto   57 Jul  3 14:11 signer.py -> /home/hebasto/dev/bitcoin/test/functional/mocks/signer.py
  ```
  - with this PR:
  ```
  $ cmake -B build
  $ ls -l build/test/functional/mocks/
  total 4
  lrwxrwxrwx 1 hebasto hebasto 65 Jul  3 13:51 invalid_signer.py -> /home/hebasto/dev/bitcoin/test/functional/mocks/invalid_signer.py
  lrwxrwxrwx 1 hebasto hebasto 64 Jul  3 13:51 multi_signers.py -> /home/hebasto/dev/bitcoin/test/functional/mocks/multi_signers.py
  lrwxrwxrwx 1 hebasto hebasto 60 Jul  3 13:51 no_signer.py -> /home/hebasto/dev/bitcoin/test/functional/mocks/no_signer.py
  lrwxrwxrwx 1 hebasto hebasto 57 Jul  3 13:51 signer.py -> /home/hebasto/dev/bitcoin/test/functional/mocks/signer.py
  ```

ACKs for top commit:
  m3dwards:
    ACK 76dae5d691
  sedited:
    ACK 76dae5d691
  janb84:
    re ACK 76dae5d691

Tree-SHA512: a720a68752c72390b9452b192b06d09e41cac1080d32cfe3c2caabb65949626771e0709e7193f69677bd24a3c747e368c2323d9c857d4aa97e1890cc463850ed
2026-02-09 11:03:58 +00:00
MarcoFalke
fa90277d22 ci: Use ubuntu-slim for [meta] runners
They should be sufficient for the task, and are based on containers, so
may be minimally faster to schedule. Ref:
https://docs.github.com/en/actions/reference/runners/github-hosted-runners#single-cpu-runners
2026-02-09 09:20:03 +01:00
MarcoFalke
fa9627af9f ci: Rely on cmake --preset toolchain file
This is the standard approach and avoids relying on
VCPKG_INSTALLATION_ROOT and -DCMAKE_TOOLCHAIN_FILE= in the ci-windows.py
script.

This makes it easier to run locally.
2026-02-09 09:20:02 +01:00
MarcoFalke
fa3f89acaa ci: Add check_manifests to ci-windows.py
This is mostly a refactor, except for placing the bitcoind.manifest into
a different folder.
2026-02-09 09:19:17 +01:00
MarcoFalke
1111079a16 ci: Add run_tests step to ci-windows.py
This is mostly a refactor, except for using the runner workspace (cwd) for:
* fuzz qa-assets
* functional temp prefix

This makes it easier to run the ci-windows.py locally.
2026-02-09 09:18:39 +01:00
merge-script
6d625af283 Merge bitcoin/bitcoin#32621: contrib: utxo_to_sqlite.py: add option to store txid/spk as BLOBs
7378f27b4f test: run utxo-to-sqlite script test with spk/txid format option combinations (Sebastian Falbesoner)
b30fca7498 contrib: utxo_to_sqlite.py: add options to store txid/spk as BLOBs (Sebastian Falbesoner)

Pull request description:

  This PR is a late follow-up to https://github.com/bitcoin/bitcoin/pull/27432, introducing an option for the utxo-to-sqlite script to store the txid/scriptPubKey columns as bytes (= `BLOB` storage class in sqlite, see e.g. https://www.sqlite.org/datatype3.html in sqlite) rather than hex strings. This was proposed in earlier reviews (https://github.com/bitcoin/bitcoin/pull/27432#issuecomment-1516857024, https://github.com/bitcoin/bitcoin/pull/27432#issuecomment-1653739351) and has the obvious advantage of a significantly smaller size of the resulting database (and with that, faster conversion) and the avoidance of hex-to-bytes conversion for further processing of the data [1]. The rationale on why hex strings were chosen back then (and still stays the default, if only for compatibility reasons) is laid out in https://github.com/bitcoin/bitcoin/pull/27432#issuecomment-1516922824 [2].

  The approach taken is introducing new parameters `--spk` and `--txid` which can either have the values "hex", "raw" (for scriptpubkey) and "hex", "raw", "rawle" (for txid). Thanks to ajtowns for providing this suggestion. Happy to take further inputs on naming and thoughts on future extensibility etc.

  [1] For a concrete example, I found that having these columns as bytes would be nice while working on a SwiftSync hints generator tool (https://github.com/theStack/swiftsync-hints-gen), which takes the result of the utxo-to-sqlite tool as input.
  [2] note that in contrast what I wrote back then, I think there is no ambiguity on byte-string-serialization of txids; they are ultimately just hash results and hence, they should be stored as such, and adding a big/little endian knob wouldn't make much sense. The drawback of not being able to immediately show txid-strings (as one would need to do the bytes-reversal step first, which is not possible in sqlite, see e.g. https://github.com/bitcoin/bitcoin/pull/24952#issuecomment-1165499803) still remains though.

ACKs for top commit:
  ajtowns:
    ACK 7378f27b4f
  w0xlt:
    reACK 7378f27b4f
  sedited:
    ACK 7378f27b4f

Tree-SHA512: 265991a1f00e3d69e06dd9adc34684720affd416042789db2d76226e4b31cf20adc433a74d14140f17739707dee57e6703f72c20bd0f8dd08b6d383d3f28b450
2026-02-08 10:37:45 +01:00
merge-script
8f0e1f6540 Merge bitcoin/bitcoin#34465: refactor: separate log generation from log handling
37cc2a2d95 logging: use util/log.h where possible (stickies-v)
bb8e9e7c4c logging: Move message formatting to util/log.h (stickies-v)
001f0a428e move-only: Move logging macros to util/log.h (stickies-v)
94c0adf4e8 move-onlyish: Move logging levels to util/log.h (stickies-v)
56d113cab0 move-only: move logging categories to logging/categories.h (stickies-v)
f5233f7e98 move-only: Move SourceLocation to util/log.h (stickies-v)

Pull request description:

  This is a mostly move-only change. It's a small refactoring that allows logging macros to be used by including a simple `util/log.h` header instead of the full `logging.h` logging implementation. Most of the changes here were cherry-picked from #34374.

  Original motivation for this change was to reduce the size and complexity of #34374 (kernel structured logging PR) and reduce the number of conflicts it causes with other PRs. But this should also make sense as a standalone change to have a clearer separation of concerns between log generation and log handling, and avoid needing to depend on the whole logging framework in call sites that only emit log messages.

  Recommended to review with `--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`

ACKs for top commit:
  l0rinc:
    diff ACK 37cc2a2d95
  stickies-v:
    re-ACK 37cc2a2d95
  optout21:
    crACK 37cc2a2d95
  sedited:
    ACK 37cc2a2d95

Tree-SHA512: c7a761323ae63f07ad290d4e3766ba1348a132c8cc68a9895fa9ae5c89206599c00646c42ef77223ac757b9d8bfe6c181bead15e7058e4d8966b3bac88a8f950
2026-02-07 23:01:17 +01:00
merge-script
b2805eec35 Merge bitcoin/bitcoin#34528: test: Fix intermittent failure in feature_assumevalid.py by ensuring invalid block was processed before checking debug.log
b73a62f667 test: Ensure invalid block was processed before checking debug.log (Ava Chow)

Pull request description:

  Prior to merging a PR, I run 4 different build configurations and their tests in parallel, and consistently one of those will have `feature_assumevalid.py` fail. The failure is because the `assert_debug_log` context exits before the invalid block is processed, so the lines it is looking for don't appear in the part of the log that it is examining.

  This PR should resolve that issue by waiting for `getchaintips` to report that the invalid chain is invalid before exiting the `assert_debug_log` context.

ACKs for top commit:
  l0rinc:
    tested ACK b73a62f667
  sedited:
    ACK b73a62f667

Tree-SHA512: 96409ed55f686961c47949d31569d6be8e424d952883c92a9135a4e8a795047d4e2a86c9d27ef5653d21780717275434b0bca1586059cfd5088cd2c867c7baea
2026-02-07 15:08:08 +01:00
Hennadii Stepanov
72030efd4b Merge bitcoin/bitcoin#34525: Release: Prepare "Open Transifex translations for v31.0" step
576f892027 qt: Update the `src/qt/locale/bitcoin_en.xlf` translation source file (Hennadii Stepanov)
4b9f5beafe Update Transifex slug for 31.x (Hennadii Stepanov)

Pull request description:

  This PR follows our [Release Process](46e1288df2/doc/release-process.md).

  It is required to open Transifex translations for v31.0, as scheduled in https://github.com/bitcoin/bitcoin/issues/33607.

  For reference, see the previous similar PR: https://github.com/bitcoin/bitcoin/pull/33152.

  **Note for reviewers:**

  To reproduce the diff in the last commit, run:
  ```
  cmake --preset dev-mode
  cmake --build build_dev_mode --target translate
  ```

ACKs for top commit:
  stickies-v:
    ACK 576f892027

Tree-SHA512: 9875831b8ea6ace5b6e47fe10351bc7cdd26b9c27fe275f678c7f33f6df115ce3e956f9d522905b2fda76d82fc0a4135482cfb665c4428ab2bc1164c49cf82f4
2026-02-07 13:07:18 +00:00
Hao Xu
fe0b1513a7 test: add a test for txgraph staging
staging is a batching mechanism for txgraph, add a test for this
feature.
2026-02-07 13:06:52 +00:00
Hao Xu
ef253a9d3d test: add block builder tests for txgraph
Add block builder tests to make sure chunks for a cluster are all right.
2026-02-07 13:06:26 +00:00
Hao Xu
4a1ac31e97 test: add a chunk test for txgraph
Add a test for GetWorstMainChunk(), which picks the worst chunk from
txgraph.

Co-developed-by: rkrux <rkrux.connect@gmail.com>
2026-02-07 13:06:19 +00:00
merge-script
54bd49c7e3 Merge bitcoin/bitcoin#34452: test: split interface_ipc.py
633d183119 test: misc interface_ipc_mining.py improvements (Sjors Provoost)
52ccd9215e test: split interface_ipc_mining.py into subtests (Sjors Provoost)
4e49fa2a68 test: add interface_ipc_mining.py (Sjors Provoost)
01a1ae889e test: move IPC helpers to ipc_util.py (Sjors Provoost)

Pull request description:

  This test has been growing too large, making it difficult to maintain. Especially when multiple pull requests change it.

  - move helper functions to `ipc_util.py`
  - move mining test to `interface_ipc_mining.py`, keeping only an interface sanity check in `interface_ipc.py`
  - split the tests in `interface_ipc_mining.py`
  - misc tweaks (to reduce churn in the above commits)

  Review hint:

  ```sh
  git show --color-moved=dimmed-zebra --color-moved-ws=ignore-space-change
  ```

ACKs for top commit:
  janb84:
    re ACK 633d183119
  fjahr:
    reACK 633d183119
  l0rinc:
    code review ACK 633d183119
  sedited:
    Re-ACK 633d183119

Tree-SHA512: 81bbbec1f03a6ff63068dbefc1bc4768fcd24313d84ba454bb2494fe4a65838dbaeb93ad7f02ed4c9932394f3d24638453bb51ce0e05f561dc613414beda37e4
2026-02-07 10:07:08 +01:00
Ava Chow
3b39a8aeb4 Merge bitcoin/bitcoin#34483: refactor: Use SpanReader over DataStream
fa0677d131 refactor: Use SpanReader over DataStream (MarcoFalke)
fad3eb3956 refactor: Use SpanReader over DataStream (MarcoFalke)
fa06e26764 refactor: [qt] Use SpanReader to avoid two vector copies (MarcoFalke)
fabd4d2e2e refactor: Avoid UB in SpanReader::ignore (MarcoFalke)
fa20bc2ec2 refactor: Use empty() over eof() in the streams interface (MarcoFalke)
fa879db735 test: Read debug log for self-checking comment (MarcoFalke)

Pull request description:

  This changes all places, where possible, to use SpanReader over DataStream. This makes the code easier to read and reason about, because `SpanReader` can never write data. Also, the code should be minimally faster, because it avoids a full redundant copy of the whole vector of bytes.

ACKs for top commit:
  stickies-v:
    re-ACK fa0677d131
  achow101:
    ACK fa0677d131
  janb84:
    re ACK fa0677d131
  sipa:
    crACK fa0677d131

Tree-SHA512: 1d9f43fc6e71d481cf7b8f8457f479745ee331734649e9e2c2ab00ce5d317112796c77afc328612ed004e65ac5c16fc92279d760cfb012cfddce9098c4af810f
2026-02-06 18:00:18 -08:00
Ava Chow
6f68e0c8b7 Merge bitcoin/bitcoin#34181: refactor: [p2p] Make ProcessMessage private again, Use references when non-null
fa43897c1d doc: Fix LLM nits in net_processing.cpp (MarcoFalke)
bbbba0fd4b scripted-diff: Use references when nullptr is not possible (MarcoFalke)
fac5415466 refactor: Separate peer/maybe_peer in ProcessMessages and SendMessages (MarcoFalke)
fac529188e refactor: Pass Peer& to ProcessMessage (MarcoFalke)
fa376095a0 refactor: Pass CNode& to ProcessMessages and SendMessages (MarcoFalke)
fada838014 refactor: Make ProcessMessage private again (MarcoFalke)
fa80cd3cee test: [refactor] Avoid calling private ProcessMessage() function (MarcoFalke)

Pull request description:

  There is a single unit test, which calls the internal `ProcessMessage` function. This is problematic, because it makes future changes harder, since they will need to carry over this public internal interface each time.

  Also, there is a mixed use of pointers and references in p2p code, where just based on context, a pointer may sometimes assumed to be null, or non-null. This is confusing when reading the code, or making or reading future changes.

  Fix both issues in a series of commits, to:

  * refactor the single unit test to call higher-level functions
  * Make `ProcessMessage` private again
  * Use references instead of implicit non-null pointers, mostly in a scripted-diff

ACKs for top commit:
  optout21:
    reACK fa43897c1d
  ajtowns:
    ACK fa43897c1d
  Crypt-iQ:
    crACK fa43897c1d
  achow101:
    ACK fa43897c1d

Tree-SHA512: d03d8ea35490a995f121be3d2f3e4a22d1aadfeab30bc42c4f8383dab0e6e27046260e792d9e5a94faa6777490ba036e39c71c50611a38f70b90e3a01f002c9e
2026-02-06 17:10:25 -08:00
Ava Chow
d88997b809 Merge bitcoin/bitcoin#34299: wallet: remove PreSelectedInputs and re-activate "AmountWithFeeExceedsBalance" error
48161f6a05 wallet: introduce "tx amount exceeds balance when fees are included" error (stratospher)
b7fa609ed1 wallet: remove PreSelectedInputs (stratospher)
7819da2c16 walllet: use CoinsResult instead of PreSelectedInputs (stratospher)
e5474079f1 wallet: introduce GetAppropriateTotal() in CoinsResult (stratospher)
d8ea921d01 wallet: correctly reserve in CoinsResult::All() (stratospher)
7072d825e3 wallet: ensure COutput added in set are unique (stratospher)
fefa3be782 wallet: fix, make 'total_effective_amount' optional actually optional (stratospher)

Pull request description:

  picks up https://github.com/bitcoin/bitcoin/pull/25269.

  This PR re-implements the code path so that an error message is thrown when a transaction's total amount (including fees) exceeds the available balance. It also refactors the wallet's coin selection code.

  1. the first 3 commits are unrelated to the code but few small bug fixes which are nice to fix. but also kind of impacts the remaining logic. (could PR separately if reviewers wish)
  1. c467325aaf: make `total_effective_amount` optional actually optional
  2. 2202ab5975: ensure `set<shared_ptr<COutput>>` has unique COutput
  3. a5ffbbf122: Correctly reserve size when flattening `CoinsResult.coins` map to vector

  3. the next 3 commits from 4745d5480c replace the `PreSelectedInputs` struct with `CoinsResult` and removes `PreSelectedInputs`.

  4. the last commit (e664484a6d) deals with the error message - `AmountWithFeeExceedsBalance` error inside `WalletModel::prepareTransaction` is never thrown and remains an unused code path. This is because `createTransaction` does not retrieve the fee when the process fails. The fee return arg is set only at the end of the process, when the transaction is successfully created. Therefore, if the transaction creation fails, the fee is not available inside `WalletModel::prepareTransaction` to trigger the `AmountWithFeeExceedsBalance` error.

  This PR re-implements the feature inside `CreateTransactionInternal` and adds test coverage for it.

  | on master | on PR |
  |-----------|-------|
  | <img src="https://github.com/user-attachments/assets/a903e687-2466-42c7-b898-5dec24bfe515" width="750" alt="Insufficient funds" /> | <img src="https://github.com/user-attachments/assets/74bb3c83-6132-4c09-91f0-0a446618b3c8" width="750" alt="AmountWithFeeExceedsBalance" /> |

  the unreachable code path is removed in https://github.com/bitcoin-core/gui/pull/807 which requires this PR.

ACKs for top commit:
  achow101:
    ACK 48161f6a05
  furszy:
    utACK 48161f6

Tree-SHA512: a963fac8d6714f76571df8cf9aff70601536dc6faa4326fbb5892c3f080dc393f0d7c6e2d21879c7a2c898bf0092adb154376d9b0a8929b31575ce9d1d47dec2
2026-02-06 14:30:20 -08:00
Ava Chow
b73a62f667 test: Ensure invalid block was processed before checking debug.log
In feature_assumevalid.py, we check that a modified block 102 is invalid
by asserting a message in the debug.log. However, this can
intermittently fail as exiting the assert_debug_log can occur before the
block has actually been validated, thus causing the test to fail as the
validation error message is not present in the chunk of the debug.log
being examined.

We can wait for the block to make an invalid chain tip to ensure that the log
line will be present.
2026-02-06 14:00:14 -08:00
Sjors Provoost
633d183119 test: misc interface_ipc_mining.py improvements
- share miniwallet and block create options between tests
- documentation fixes
- use assert_equal instead of assert ==
2026-02-06 15:46:31 +01:00
Sjors Provoost
52ccd9215e test: split interface_ipc_mining.py into subtests
Split the Mining interface test into focused subtests.

Keep the initial tip-change pre-mine check in run_mining_interface_test.
As a result run_block_template_test no longer has newblockref.
2026-02-06 15:46:31 +01:00
Sjors Provoost
4e49fa2a68 test: add interface_ipc_mining.py
Split Mining interface tests into interface_ipc_mining.py and keep
interface_ipc.py for echo + simple inspectors.

Register the new test in test_runner.py.

The setup code around "Create Mining proxy object" is duplicated
in the new test file, but the simple insector checks below it
are not moved.
2026-02-06 15:46:31 +01:00
Sjors Provoost
01a1ae889e test: move IPC helpers to ipc_util.py
Move IPC helpers into ipc_util.py and update interface_ipc.py
to use them.

Rename some helpers for clarity:
- parse_and_deserialize_block -> mining_get_block
- parse_and_deserialize_coinbase_tx -> mining_get_coinbase_tx
- get_coinbase_raw_tx -> mining_get_coinbase_raw_tx
- wait_next_template -> mining_wait_next_template
2026-02-06 15:44:06 +01:00
Hennadii Stepanov
28160c1e3d Merge bitcoin/bitcoin#34421: ci: add Chimera Linux LTO config
d79249d279 ci: add chimera Linux LTO CI job (fanquake)

Pull request description:

  Adds a CI config based on using [Chimera Linux](https://chimera-linux.org/). This might be interesting for any of the following:
  * Chimera is based on LLVM & musl libc - we test both of these in isolation, but not together.
  * No GNU components. I don't think we have an existing Linux CI job that doesn't have a gcc/stdlibc++ install. This exercises the depends logic for a fully LLVM/Clang/lld only build, including building the native tools (related to #33902).
  * We don't currently have a job with LTO enabled (here using CMakes `CMAKE_INTERPROCEDURAL_OPTIMIZATION`, which is `-flto=thin` for LLVM/Clang). I think this is worth having generally (we do use LTO in some other places, like oss-fuzz). If runtime is too much of an issue, then it could also be dropped. (Chimera itself is also compiled with LTO).

  QT in depends doesn't build (#32744), so is excluded for now.

  Chimera has pointed out at least a few quirks, i.e #34390, #34408 and https://github.com/bitcoin/bitcoin/pull/29963#discussion_r2707922298.

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

Tree-SHA512: 1174a7462bf2e7433a2c27a6cf398e94b05db42bb414629c71cf9f9a297ca269e173ae1b7517b30510b494b4397f918eef706d3c75c4286767c5557aeb6db4c7
2026-02-06 14:11:04 +00:00
Hennadii Stepanov
576f892027 qt: Update the src/qt/locale/bitcoin_en.xlf translation source file
Steps to reproduce the diff on Ubuntu 25.10:
```
cmake --preset dev-mode
cmake --build build_dev_mode --target translate
```
2026-02-06 13:45:34 +00:00
Hennadii Stepanov
4b9f5beafe Update Transifex slug for 31.x
Update the Transifex slug to match the new resource created for the
upcoming 31.x branch.
2026-02-06 13:40:59 +00:00
merge-script
46e1288df2 Merge bitcoin/bitcoin#34498: iwyu: Fix patch to prefer <cstdint>
b65a3d8009 iwyu: Fix patch to prefer `<cstdint>` (Hennadii Stepanov)

Pull request description:

  The goal of the [patch](https://github.com/bitcoin/bitcoin/blob/master/ci/test/01_iwyu.patch) is to suggest C++ headers rather than their C counterparts. However, for fixed width integer types, the patched IWYU currently suggests `<cinttypes>` where `<cstdint>` is sufficient.

  This PR fixes this behavior.

ACKs for top commit:
  maflcko:
    lgtm ACK b65a3d8009
  furszy:
    utACK b65a3d8009
  willcl-ark:
    utACK b65a3d8009

Tree-SHA512: 695efdd44b92a642401738572e49c8b6591aa4463d387107fdf3d2f7c9c4b39f4097cb82413752caf9e8890dcca7246a894e562a1dd17023b05a7e455705beac
2026-02-06 13:37:14 +00:00
MarcoFalke
fa6801366d refactor: [rpc] Remove confusing and brittle integral casts (take 2) 2026-02-06 13:44:51 +01:00
fanquake
d79249d279 ci: add chimera Linux LTO CI job 2026-02-06 12:03:18 +00:00
stratospher
48161f6a05 wallet: introduce "tx amount exceeds balance when fees are included" error
This was previously implemented at the GUI level but we never hit that
code path.

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
2026-02-06 16:27:22 +05:30
stratospher
b7fa609ed1 wallet: remove PreSelectedInputs 2026-02-06 16:27:22 +05:30
stratospher
7819da2c16 walllet: use CoinsResult instead of PreSelectedInputs
PreSelectedInputs is confusing to use. it's `total_amount`
might store total amount or effective amount based on SFFO.
ex: we might accidentally sum preselected inputs effective
amount (named `total_amount`) with automatically selected
inputs actual total amount.

CoinsResult has a cleaner interface with separate fields
for both these amounts.

2 behavioural changes:

1. no more default assert error if effective value is unset
    - previously PreSelectedInputs::Insert() called
      COutput::GetEffectiveValue() which assert failed
      if the optional was unset.
    - now we don't default assert anymore.
      * in GUI/getAvailableBalance better not to assert.
      * SelectCoins's preselected inputs always contain a
        feerate, so effective amount should be set.
        explicitly added an assertion to ensure this.

2. FetchSelectedInputs uses OutputType::UNKNOWN as key to
   populate CoinsResult's coins map. it's discarded later.
2026-02-06 16:27:21 +05:30
merge-script
0cd309c75e Merge bitcoin/bitcoin#34492: ci: Drop valgrind fuzz from GHA matrix
faa4ab113c ci: Drop valgrind fuzz from GHA matrix (MarcoFalke)

Pull request description:

  The valgrind fuzz task is problematic, because:

  * It is redundant with the msan fuzz task, which has std lib hardening enabled, so often UB is diagnosed before it even happens in the valgrind task.
  * All issues so far found by the valgrind fuzz task were also found by the hardened msan fuzz task.
  * All other issues were false-positives, which are hard to debug, and confusing and tedious to work around.

  I don't think there is any value in asking pull request authors to debug valgrind false-positives that they triggered by accident. So remove the task for now.

  I know that there are some devs, who like to keep the task, but if the task is kept, it should come with clear instructions on how to deal with false-postives in pull requests.

  I am not proposing to remove the config itself, and I am happy to continue maintaining it, like it was done before. However, as of now, running it in the GHA matrix is of negative or questionable benefit.

ACKs for top commit:
  l0rinc:
    ACK faa4ab113c
  fanquake:
    ACK faa4ab113c - hopefully we can revisit re-adding soon. To be clear, I don't agree with the rationale from #34304, or the initial changes there. The case here, and the fact that it is causing disruption in this repo, is more pressing.

Tree-SHA512: 59272f4b5b01c3b8ee6078ea635441f17776d4d8923f1adacdabdbb00bd2eb0234b30dc5b27938e29f8e79b3c3bebed5f339ae36c2c8fb17ea9d3a2884bee986
2026-02-06 10:28:04 +00:00
MarcoFalke
fa561682ce ci: [refactor] Add .github/ci-windows.py prepare_tests step 2026-02-06 09:54:28 +01:00
MarcoFalke
fa3e607c6d ci: Print verbose Windows CI build failure 2026-02-06 08:55:42 +01:00
MarcoFalke
4444808dd3 ci: [refactor] Add .github/ci-windows.py build step
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-06 08:54:26 +01:00