Commit Graph

47216 Commits

Author SHA1 Message Date
merge-script
c60f9cb66e Merge bitcoin/bitcoin#34085: cluster mempool: exploit SFL properties in txgraph
1808b5aaf7 clusterlin: remove unused FixLinearization (cleanup) (Pieter Wuille)
34a77138b7 txgraph: permit non-topological clusters to defer fixing (optimization) (Pieter Wuille)
3380e0cbb5 txgraph: use PostLinearize less prior to linearizing (Pieter Wuille)
62dd88624a txgraph: drop NEEDS_SPLIT_ACCEPTABLE (simplification) (Pieter Wuille)
01ffcf464a clusterlin: support fixing linearizations (feature) (Pieter Wuille)

Pull request description:

  Part of #30289, follow-up to #32545.

  This gets rid of `FixLinearization()` by integrating the functionality into `Linearize()`, and makes txgraph exploit that (by delaying fixing of clusters until their first re-linearization). It also reduces (but does not eliminate) the number of calls to `PostLinearize`, as the SFL linearization effectively performs something very similar to postlinearization when loading in an existing linearization already.

ACKs for top commit:
  instagibbs:
    reACK 1808b5aaf7
  marcofleon:
    code review ACK 1808b5aaf7

Tree-SHA512: 81cd9549de2968f5126079cbb532e2cb052ea8157c9c9ce37fd39ad2294105d7c79ee8d946c3d8f7af5b2119299a232c448b42a33e1e43ccc778a5b52957e387
2026-01-06 15:51:45 +00:00
merge-script
114901c065 Merge bitcoin/bitcoin#34203: doc: p2p: replace last remaining "command" terminology with "message type"
5b7bf47f9b doc: p2p: replace last remaining "command" terminology with "message type" (Sebastian Falbesoner)

Pull request description:

  This small PR is (presumably) the final one in a long series of replacing the confusing "command" terminology with "message type" when referring to the header field of P2P messages, see #18533, #18937, #24078, #24141 and #31163.

  The instances were found manually via `$ git grep -i command`, hope I didn't miss any.

ACKs for top commit:
  l0rinc:
    ACK 5b7bf47f9b
  billymcbip:
    ACK 5b7bf47f9b
  maflcko:
    lgtm ACK 5b7bf47f9b

Tree-SHA512: b895873b82f904c2ee9a81b4a2fbb365b60c57f04587ded5ddc7907d209520acb6073f5dd1a19cb2ae6aadab3c85a5ac751c8c398ce7c0e29314eea54e61295c
2026-01-06 09:45:34 +00:00
merge-script
d7cbdfa090 Merge bitcoin/bitcoin#34204: test: fix intermittent failure in p2p_addr_selfannouncement
31852057ea test: fix intermittent failure in p2p_addr_selfannouncement (0xb10c)

Pull request description:

  Due to the mocktime being bumped before the expected time is updated, it could happen that the self-announcement is send with an newer timestamp than what we expect. To fix this, update the expected time before we bump the mocktime.

  closes #34159

ACKs for top commit:
  bensig:
    ACK 31852057ea
  maflcko:
    lgtm ACK 31852057ea
  w0xlt:
    ACK 31852057ea
  naiyoma:
    utACK 31852057ea

Tree-SHA512: 24696f6005c7131d4c9328f6ff43ddded863b8ba6b2cac6f6009bcb4617616c0c35a0b55812d5010f74385d8e6d4ea09dd2b06b5f4ada2bb7e86d7abee764192
2026-01-06 09:38:12 +00:00
Ava Chow
0ad4376a49 Merge bitcoin/bitcoin#33142: test: Run bench sanity checks in parallel with functional tests
fa65bc0e79 test: Run bench sanity checks in parallel with functional tests (MarcoFalke)
fa9fdbce79 test: Pass bench exe into test framework utils (MarcoFalke)

Pull request description:

  The ctest target `bench_sanity_check` has many issues:

  * With sanitizers enabled, it is one of the slowest targets, often taking several minutes. See https://github.com/bitcoin/bitcoin/issues/32770#issuecomment-2984264066.
  * There is no insight from ctest into how long each individual sanity check takes.
  * On a timeout, or OOM issue, there is no insight into which sub-bench failed. The failure will generally just look like `75/153 Test   #9: bench_sanity_check ...................***Failed  770.84 sec    out of memory`
  * Places that can't use ctest (like the Windows-cross CI task) have to explicitly run it, or risk forgetting to run it.
  * All benchmarks are run sequentially, when they could run in parallel instead.

  Both issues can lead to CI timeouts and leave CPU unused during testing.

  Fix all issues by running it as part of the functional tests instead. This is similar to the rpcauth tests (https://github.com/bitcoin/bitcoin/pull/32881) and util tests [bitcoin-tx, and bitcoin-util] (https://github.com/bitcoin/bitcoin/pull/32697).

ACKs for top commit:
  achow101:
    ACK fa65bc0e79
  l0rinc:
    Tested ACK fa65bc0e79
  janb84:
    tACK fa65bc0e79
  willcl-ark:
    ACK fa65bc0e79

Tree-SHA512: d27e363b7896a7543a4ee8df41a56e58b74f07d4f296e2e5ee293fc91817d0be310e26905755fb94d44417d94fa29ad4cc5d4aa19e78d25d41bc2d9e0948c034
2026-01-05 15:47:49 -08:00
Ava Chow
c267b3a2c6 Merge bitcoin/bitcoin#34197: rpc, net: deprecate startingheight field of getpeerinfo RPC
4ce3f4a265 rpc, net: deprecate `startingheight` field of `getpeerinfo` RPC (Sebastian Falbesoner)

Pull request description:

  This PR deprecates the "startingheight" result field of the `getpeerinfo` RPC, following the discussion in #33990.

  Rationale: the reported starting height of a peer in the VERSION message is untrusted, and it doesn't seem to be useful anymore (after #20624), so deprecating the corresponding field seems reasonable. After that, it can be removed, along with the `m_starting_height` field of the Peer / CNodeStats structs, as it is sufficient to show the reported height only once at connection in the debug log.

ACKs for top commit:
  optout21:
    crACK 4ce3f4a265
  achow101:
    ACK 4ce3f4a265
  fjahr:
    utACK 4ce3f4a265
  rkrux:
    crACK 4ce3f4a265
  janb84:
    cr ACK 4ce3f4a265

Tree-SHA512: b296a28d30084fd35c67a2162e85576e3365e5d6fffe5b1add500034c1850604ee8c37b61afe812bfab8a7cc20f6a9e22db445e3c371311a5f82a777e5700ebf
2026-01-05 15:17:48 -08:00
Ava Chow
d6a6afd955 Merge bitcoin/bitcoin#34010: psbt: detect invalid MuSig2 pubkeys in deserialization
5805a8b540 psbt: detect invalid MuSig2 pubkeys in deserialization (rkrux)

Pull request description:

  Throw error while deserializing PSBT if invalid pubkeys are passed
  as a MuSig2 aggregate or participant.

  Should fix #33999 & #34201 by throwing error at the very start while decoding
   an invalid PSBT that should subsequently not allow the MuSig2
  signing operation to take place, thereby avoiding the crash.

ACKs for top commit:
  fjahr:
    utACK 5805a8b540
  achow101:
    ACK 5805a8b540

Tree-SHA512: 4741db96b278e9f3d532e1873af9530a70bbc7a8d3625b9e1c07001acc472fc10cbb79995c16bc4d06cc568ef98fe8d2b8e8d87b617dc05d7554085ffb92dfef
2026-01-05 14:56:25 -08:00
Sebastian Falbesoner
5b7bf47f9b doc: p2p: replace last remaining "command" terminology with "message type" 2026-01-05 17:59:53 +01:00
Pieter Wuille
1808b5aaf7 clusterlin: remove unused FixLinearization (cleanup) 2026-01-05 11:48:34 -05:00
Pieter Wuille
34a77138b7 txgraph: permit non-topological clusters to defer fixing (optimization) 2026-01-05 11:48:30 -05:00
Pieter Wuille
3380e0cbb5 txgraph: use PostLinearize less prior to linearizing
With the new SFL algorithm, the process of loading an existing linearization into the
SFL state is very similar to what PostLinearize does. This means there is little benefit
to performing an explicit PostLinearize step before linearizing inside txgraph. Instead,
it seems better to use our allotted CPU time to perform more SFL optimization steps.
2026-01-05 11:48:16 -05:00
Pieter Wuille
62dd88624a txgraph: drop NEEDS_SPLIT_ACCEPTABLE (simplification)
With the SFL algorithm, we will practically be capable of keeping
most if not all clusters optimal. With that, it seems less valuable
to avoid doing work after splitting an acceptable cluster, because by
doing some work we may get it to OPTIMAL.

This reduces the complexity of the code a bit as well.
2026-01-05 11:48:16 -05:00
Pieter Wuille
01ffcf464a clusterlin: support fixing linearizations (feature)
This also updates FixLinearization to just be a thin wrapper around Linearize.
In a future commit, FixLinearization will be removed entirely.
2026-01-05 11:48:16 -05:00
merge-script
755f0900a2 Merge bitcoin/bitcoin#34136: test: Allow mempool_updatefromblock.py to run on 32-bit
fac5a1b10a test: Allow mempool_updatefromblock.py to run on 32-bit (MarcoFalke)

Pull request description:

  The number of dropped parent transactions in the `test_max_disconnect_pool_bytes` test was hard-coded to `2`.

  This happens to work fine on 64-bit for now. However, it seems to fail on 32-bit (https://github.com/bitcoin/bitcoin/issues/34108).

  I don't think we care about the exact number, as long as it is at least `1`.

  So hard-code `1` for an initial sanity check, and then calculate the exact value at runtime via `len(mempool) // 2`.

  Also, enable the functional tests in 32-bit CI, to confirm the regression test.

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

ACKs for top commit:
  bensig:
    ACK fac5a1b10a
  instagibbs:
    ACK fac5a1b10a

Tree-SHA512: 8d468f306d95e52cbfac1803293e3b8e9575c9010200010c7833382112509e0d51827dc9681b0b68eeae742af2c14d12da5fd4cf0e1d871a02f91fc80e6720d1
2026-01-05 14:51:24 +00:00
rkrux
5805a8b540 psbt: detect invalid MuSig2 pubkeys in deserialization
Throw error while deserializing PSBT if invalid pubkeys are passed
as a MuSig2 aggregate or participant.
2026-01-05 16:24:26 +05:30
0xb10c
31852057ea test: fix intermittent failure in p2p_addr_selfannouncement
Due to the mocktime being bumped before the expected time is updated,
it could happen that the self-announcement is send with an newer
timestamp than what we expect. To fix this, update the expected time
before we bump the mocktime.

closes #34159
2026-01-05 10:28:32 +01:00
merge-script
bd4f4782f2 Merge bitcoin/bitcoin#34154: test: Enable ruff E713 lint
fab300b378 test: Enable ruff E713 lint (MarcoFalke)

Pull request description:

  Membership tests of the form `not item in stuff` may be confusing, because they could be read as `(not item) in stuff`, which is different.

  So enable the ruff E713 lint, which should also help to avoid having to go through review cycles for this.

ACKs for top commit:
  bensig:
    ACK fab300b378
  l0rinc:
    ACK fab300b378
  rkrux:
    lgtm crACK fab300b378

Tree-SHA512: c3eaf0fbe0dd22d8e04b896e98adaf28162fb748e6f7f5ebfd73b2020da66046bf8f0c1a27db5da05250366b98ded8c4a55d53edd8fa050e80521aee42ba3c5a
2026-01-04 16:22:38 +00:00
Sebastian Falbesoner
4ce3f4a265 rpc, net: deprecate startingheight field of getpeerinfo RPC
The reported starting height of a peer in the VERSION message is
untrusted, and it doesn't seem to be useful anymore (after #20624),
so deprecating the corresponding "startingheight" field seems
reasonable. After that, it can be removed, along with the
`m_starting_height` field of the Peer / CNodeStats structs, as it is
sufficient to show the reported height only once at connection in the
debug log.
2026-01-04 02:02:01 +01:00
Ava Chow
ab233255d4 Merge bitcoin/bitcoin#33866: refactor: Let CCoinsViewCache::BatchWrite return void
6da6f503a6 refactor: Let CCoinsViewCache::BatchWrite return void (TheCharlatan)

Pull request description:

  CCoinsViewCache::BatchWrite always returns true if called from a backed cache, so just return void instead. Also return void from ::Sync and ::Flush.

  This allows for dropping a FatalError condition and simplifying some dead error handling code a bit.

  Since we now no longer exercise the "error path" when returning from `CCoinsView::BatchWrite`, make the method clear the cache instead. This should only be exercised by tests and not change production behaviour. This might slightly improve the coins_view fuzz test's ability to generate better coverage.

ACKs for top commit:
  l0rinc:
    ACK 6da6f503a6
  andrewtoth:
    re-ACK 6da6f503a6
  achow101:
    ACK 6da6f503a6
  w0xlt:
    ACK 6da6f503a6

Tree-SHA512: dfaa325b0cf8108910aebf1b27434aaddb639d10d860e96797c77ea42eca9035a54a7dc1d6a5d4eae2b75fcc9356206d3d5672243d2c906e80d19024c8b95408
2026-01-02 16:49:23 -08:00
Ava Chow
2628de7479 Merge bitcoin/bitcoin#33135: wallet: warn against accidental unsafe older() import
76c092ff80 wallet: warn against accidental unsafe older() import (Sjors Provoost)
592157b759 test: move SEQUENCE_LOCKTIME flags to script (Sjors Provoost)

Pull request description:

  [BIP 379](https://github.com/bitcoin/bips/blob/master/bip-0379.md) ([Miniscript](https://bitcoin.sipa.be/miniscript/)) allows relative height and time locks that have no consensus meaning in [BIP 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki) (relative timelocks) / [BIP 112](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki) (`CHECKSEQUENCEVERIFY`). This is (ab)used by some protocols, e.g. [by Lightning to encode extra data](https://delvingbitcoin.org/t/exploring-extended-relative-timelocks/1818/23), but is unsafe when used unintentionally: `older(65536)` is equivalent to `older(1)`.

  This PR emits a warning when `importdescriptors` contains such a descriptor.

  The first commit makes `SEQUENCE_LOCKTIME` flags reusable by other tests.

  The main commit adds the `ForEachNode` helper to `miniscript.h` which is then used in the `MiniscriptDescriptor` constructor to check for `Fragment::OLDER` with unsafe values. These are stored in `m_warnings`, which the RPC code then collects via `Warnings()`.

  It adds both a unit and functional test.

  ---

  A previous version of this PR prevented the import, unless the user opted in with an `unsafe` flag. It also used string parsing in the RPC code.

  ---

  Based on:
  - [x] https://github.com/bitcoin/bitcoin/pull/33914

ACKs for top commit:
  pythcoiner:
    reACK 76c092ff80
  achow101:
    ACK 76c092ff80
  rkrux:
    lgtm re-ACK 76c092ff80
  brunoerg:
    reACK 76c092ff80

Tree-SHA512: 8e944e499bd4a43cc27eeb889f262b499b9b07aa07610f4a415ccb4e34a9110f9946646f446a54ac5bf17494d8d96a89e4a1fa278385db9b950468f27283e17a
2026-01-02 16:15:50 -08:00
merge-script
c631553732 Merge bitcoin/bitcoin#34191: doc: archive release notes for v30.1
bd730cb0a1 doc: archive release notes for v30.1 (fanquake)

Pull request description:

  (fixing the `.x` typo)

ACKs for top commit:
  marcofleon:
    ACK bd730cb0a1

Tree-SHA512: da46de525b6970a627435f0697e464514466bbd2ed368084532c920aa889908afaf8c4708362404a038ec2a14f9b50e7bac5e66faab9daff10f799f07c97028a
2026-01-02 16:11:08 +00:00
fanquake
bd730cb0a1 doc: archive release notes for v30.1 2026-01-02 15:18:51 +00:00
merge-script
6ed2cf5184 Merge bitcoin/bitcoin#34169: fuzz: change fuzz runner test_runner.py to be cwd independent
77c9b3c08f change test_runner.py to be cwd independent by calling subprocess.run with cwd arg. (Robin David)

Pull request description:

  Dear Maintainers,

  While using `test_runner.py` that runs fuzz tests and produces coverage results I encountered the following error.

  If not running the script from the project root directory the `git grep --function-context [...]` does not return the same output which results in the following Python error:

  ```
  ../../src/protocol.h-', '../../../src/protocol.h-/** nServices flags */']
  Traceback (most recent call last):
    File "/path/to/bitcoin/build_libfuzzer/test/fuzz/./test_runner.py", line 405, in <module>
      main()
      ~~~~^^
    File "/path/to/bitcoin/build_libfuzzer/test/fuzz/./test_runner.py", line 173, in main
      return generate_corpus(
          fuzz_pool=fuzz_pool,
      ...<3 lines>...
          targets=test_list_selection,
      )
    File "/path/to/bitcoin/build_libfuzzer/test/fuzz/./test_runner.py", line 249, in generate_corpus
      targets = transform_process_message_target(targets, Path(src_dir))
    File "/path/to/build_libfuzzer/test/fuzz/./test_runner.py", line 218, in transform_process_message_target
      assert len(lines)
             ~~~^^^^^^^
  AssertionError
  ```

  The script is not able to retrieve lines as the filter applied is:

  ```python
  lines = [l.split("::", 1)[1].split(",")[0].lower() for l in lines if l.startswith("src/protocol.h-    NetMsgType::")]
  ```

  Which when running from the root directory returns:
  ```
  [snip]
  src/protocol.h-    NetMsgType::VERSION,
  [snip]
  ```
  but returns a relative path to CWD when run from other directories e.g:
  ```
  ../../../src/protocol.h-    NetMsgType::VERSION,
  ```

  This is very unfortunate as the script rightfully read the `config.ini` relatively to itself and go fetch `BUILDDIR` and `SRCDIR`  variables to obtain absolute paths.

  Options are:
  * enforce running the script from *bitcoin/* directory  (and thus explicitly mentioning it in the doc)
  * make the script independent from where it is being run

  I chose the second option as it was fairly easy to make the script independent from where it is being run.

ACKs for top commit:
  maflcko:
    lgtm ACK 77c9b3c08f
  dergoegge:
    Code review ACK 77c9b3c08f

Tree-SHA512: fbc821c4790dd9ac125046a842498e0d9a48549d1c8ef150bce2193ee62bee9c3bfd4b17ce278411102dd200dc9ad86a176ecae29ca1667bb14d6f90ad67e01d
2026-01-02 11:03:04 +00:00
merge-script
fb49d62d8f Merge bitcoin/bitcoin#34177: policy/refactor: remove constant parameter from IsWellFormedPackage
658d38106a policy: remove constant parameter from `IsWellFormedPackage` (Lőrinc)

Pull request description:

  `IsWellFormedPackage()` already claims: "parents must appear before children." In practice the `require_sorted` argument was always passed as `true`, making the false-path dead code. It was introduced that way from the beginning in https://github.com/bitcoin/bitcoin/pull/28758/files#diff-f30090b30c9489972ee3f1181c302cf3a484bb890bade0fd7c9ca92ea8d347f6R79.

  Remove the unused parameter, updating callers/tests.

ACKs for top commit:
  billymcbip:
    tACK 658d38106a
  instagibbs:
    ACK 658d38106a

Tree-SHA512: 8b86dda7e2e1f0d48947ff258f0a3b6ec60676f54d4b506604d24e15c8b6465358ed2ccf174c7620125f5cad6bfc4df0bc482d920e5fc4cd0e1d72a9b16eafa5
2026-01-02 10:25:40 +00:00
MarcoFalke
fa65bc0e79 test: Run bench sanity checks in parallel with functional tests 2026-01-01 20:44:09 +01:00
MarcoFalke
fa9fdbce79 test: Pass bench exe into test framework utils
This teaches the test framework about the bench executable, which is
required for the next commit.
2026-01-01 20:38:59 +01:00
merge-script
adbb4b3208 Merge bitcoin/bitcoin#34174: doc: update copyright year to 2026
b23b901363 doc: update copyright year (fanquake)

Pull request description:

  Bump in the places that need bumping.

ACKs for top commit:
  fjahr:
    ACK b23b901363
  maflcko:
    lgtm ACK b23b901363
  pinheadmz:
    ACK b23b901363
  janb84:
    LGTM ACK b23b901363

Tree-SHA512: 25a546a060447a5ad37f8cc2e1d8e85420a1e38980fb09124170112ccbd1a311c9e99f31e712575b5d4f5d45524b2e2de15122e7021f3eb68c9d0dce534a37c9
2025-12-31 13:17:36 +00:00
merge-script
891aed2f75 Merge bitcoin/bitcoin#34172: Fix intermittent issue in p2p_1p1c_network.py
95ef0fc5e7 test: ensure clean orphanage before continuing (Greg Sanders)
25e84d3772 test: change low fee parents to 0-fee (Greg Sanders)

Pull request description:

  Resolves https://github.com/bitcoin/bitcoin/issues/33318 in a minimal fashion. Given that the orphan transactions aren't being persisted anymore, I'm not that specific case offers much coverage, but kept it around for now to get rid of the timeouts at least.

ACKs for top commit:
  glozow:
    utACK 95ef0fc5e7

Tree-SHA512: 4952062cb46b0e9f665de454718d093d3eac17532e4330caf80290f82b130614db3ccc5e5abf06f1e66237b9ba53ecdd0d13e4d5b09812f5c91db00b948ebb6b
2025-12-31 11:26:56 +00:00
merge-script
7590a72a5e Merge bitcoin/bitcoin#34182: doc: Update OpenBSD Build Guide
84d8c52662 doc: Update OpenBSD Build Guide (Hennadii Stepanov)

Pull request description:

  [OpenBSD 7.8](https://www.openbsd.org/78.html) ships LLVM/Clang 19.1.7, which satisfies the recently [updated](https://github.com/bitcoin/bitcoin/pull/33555) minimum requirement.

ACKs for top commit:
  katesalazar:
    ACK 84d8c52662
  janb84:
    ACK 84d8c52662

Tree-SHA512: 06644733702d72687a2e860cf561c9ca39a3cf1d7c339c94f2b87d36b530776f7e7d0f7e3d22cd858ee8639bd4e85c47081602cbe829c7406cdcd65380e84130
2025-12-31 11:15:38 +00:00
merge-script
a50d7a7929 Merge bitcoin/bitcoin#34183: doc: fix double-word typos in comments
08ed802bab doc: fix double-word typos in comments (bensig)

Pull request description:

  Spotted a few duplicated words while reading through the code:

  1. "the the" in mempool_stress.cpp
  2. "to to" in txgraph.cpp
  3. "for for" in cluster_linearize.h
  4. "that that" in txrequest.h
  5. "in in" in test/fuzz/txgraph.cpp

ACKs for top commit:
  l0rinc:
    ACK 08ed802bab
  maflcko:
    lgtm ACK 08ed802bab

Tree-SHA512: e4eeb9a95489b4c46fbb7a0dbeb549d70a2b087ab6400cc6ba89cbfc015b40e580fab8a68913499af7c83a988e66642dcc7a222b70d2eda5c57f4a02b5a556ae
2025-12-31 11:10:32 +00:00
Hennadii Stepanov
2bff9ebeff Merge bitcoin/bitcoin#34102: depends: capnp 1.3.0
719158db5c depends: capnp 1.3.0 (fanquake)

Pull request description:

  Update capnp in depends to `1.3.0`.

  Changes: https://github.com/capnproto/capnproto/compare/release-1.2.0...release-1.3.0.

ACKs for top commit:
  Sjors:
    ACK 719158db5c
  sedited:
    ACK 719158db5c
  hebasto:
    ACK 719158db5c. Guix now uses the same [`capnproto`](https://packages.guix.gnu.org/packages/capnproto) version as a dependency for the [`bitcoin-core`](https://packages.guix.gnu.org/packages/bitcoin-core) package.

Tree-SHA512: 7e25e2a39c85d8a767da3789560152163ec04b2657b9025db0e0683f98295febabf89532c874f41bf82e024c9ce06b5aef68dc4555f9d9f68022cfa791d8f407
2025-12-30 23:51:22 +00:00
bensig
08ed802bab doc: fix double-word typos in comments 2025-12-30 12:12:26 -08:00
Hennadii Stepanov
84d8c52662 doc: Update OpenBSD Build Guide 2025-12-30 19:45:14 +00:00
Robin David
77c9b3c08f change test_runner.py to be cwd independent by calling subprocess.run with cwd arg. 2025-12-30 11:30:21 +01:00
Lőrinc
658d38106a policy: remove constant parameter from IsWellFormedPackage
`IsWellFormedPackage()` already claims: "parents must appear before children."
In practice the `require_sorted` argument was always passed as `true`, making the false-path dead code.
It was introduced that way from the beginning in https://github.com/bitcoin/bitcoin/pull/28758/files#diff-f30090b30c9489972ee3f1181c302cf3a484bb890bade0fd7c9ca92ea8d347f6R79.

Remove the unused parameter, updating callers/tests.
2025-12-29 21:26:35 +01:00
fanquake
b23b901363 doc: update copyright year 2025-12-29 17:50:43 +00:00
Greg Sanders
95ef0fc5e7 test: ensure clean orphanage before continuing
The tests were written assuming transaction orphans would
persist for a time beyond the test peer's disconnection.
After #31829 this no longer holds, so as a minimal fix we
modify the test to wait until the orphans are removed before
continuing with the final transaction submissions.
2025-12-29 11:05:14 -05:00
Greg Sanders
25e84d3772 test: change low fee parents to 0-fee
The test is harder to read, and had an explicit 1sat/vbyte
floor assumption in a single place which is incorrect. Using
0-fee makes the test more future proof.
2025-12-29 11:05:14 -05:00
merge-script
2bcb3f6464 Merge bitcoin/bitcoin#34112: rpc: [mempool] Remove erroneous Univalue integral casts
fab1f4b800 rpc: [mempool] Remove erroneous Univalue integral casts (MarcoFalke)

Pull request description:

  Casting without reason can only be confusing (because it is not needed), or wrong (because it does the wrong thing).

  For example, the added test that adds a positive chunk prioritization will fail:

  ```
  AssertionError: not(-1.94936096 == 41.000312)
  ```

  Fix all issues by removing the erroneous casts, and by adding a test to check against regressions.

ACKs for top commit:
  rkrux:
    tACK fab1f4b800
  pablomartin4btc:
    ACK fab1f4b800
  glozow:
    ACK fab1f4b800

Tree-SHA512: b03c888ec07a8bdff25f7ded67f253b2a8edd83adf08980416e2ac8ac1b36ad952cc5828be833d19f64a55abab62d7a1c6f181bc5f1388ed08cc178b4aaec6ee
2025-12-29 07:16:39 -08:00
merge-script
7249bcc4f8 Merge bitcoin/bitcoin#34119: contrib: remove copyright_header.py
ba6315d2f6 contrib: remove copyright_header.py (fanquake)
3e4765ee10 scripted-diff: [doc] Unify stale copyright headers (fanquake)

Pull request description:

  After #34084, our copyright headers shouldn't need "managing"; so remove the Python script.

ACKs for top commit:
  fjahr:
    ACK ba6315d2f6
  rkrux:
    crACK [ba6315d](ba6315d2f6)
  janb84:
    ACK ba6315d2f6

Tree-SHA512: c0d6ed0a71803c5ae6c70260fa4162bea1f1b24cf6fc9b58e018bb9d6a673d2d59c25a17deda067a268024e3757081e3a214680e1e626d71c0debc5066d5f623
2025-12-29 07:03:02 -08:00
merge-script
0f6a526f43 Merge bitcoin/bitcoin#34160: policy: Remove stale rationale paragraph
337b4a2369 Remove stale rationale paragraph (flack)

Pull request description:

  It belonged to the note removed in #33892

ACKs for top commit:
  instagibbs:
    ACK 337b4a2369

Tree-SHA512: 3cb1d3b87aa42ff92130af10ce2c286c0d83cbfdf17096d47b540ffe8e1a9a4727aedb8d477599fbff0002d7e262a6a52549dcccfa38dbe61281c221cf26cae2
2025-12-29 10:54:48 +00:00
flack
337b4a2369 Remove stale rationale paragraph
It belonged to the note removed in #33892
2025-12-27 22:33:23 +01:00
merge-script
94ddc2dced Merge bitcoin/bitcoin#34113: refactor: [rpc] Remove confusing and brittle integral casts
fa66e2d07a refactor: [rpc] Remove confusing and brittle integral casts (MarcoFalke)

Pull request description:

  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:
  * `ret.pushKV("coinbase", static_cast<bool>(coin->fCoinBase));`, or
  * `static_cast<std::underlying_type_t<decltype(info.nServices)>>(info.nServices)`.

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

ACKs for top commit:
  sedited:
    ACK fa66e2d07a
  rkrux:
    ACK fa66e2d07a

Tree-SHA512: 13c9c59ad021ea03cdabe10d58850cef96d792634c499e62227cc2e7e5cace066ebd9a8ef3f979eaba98cadf8a525c6e6df909a07115559c0450bd9fc3a9763e
2025-12-27 16:35:21 +00:00
merge-script
c575990651 Merge bitcoin/bitcoin#34147: scripted-diff: refactor: wallet: Delete duplicate IsCrypted()
11ce5cf799 scripted-diff: refactor: wallet: Delete IsCrypted (David Gumberg)

Pull request description:

  This function is a duplicate of `HasEncryptionKeys()`.

ACKs for top commit:
  maflcko:
    review ACK 11ce5cf799 🔀
  billymcbip:
    utACK [11ce5cf](11ce5cf799)
  polespinasa:
    code review tACK 11ce5cf799
  rkrux:
    crACK 11ce5cf799

Tree-SHA512: 24bd9fedb17fab092346953558b25a2e4181d8f3750cedd0ecf3939291216190d442a38c93aa6829a3a88e60d94b90cada42136c24fd0fabe367994fc1e89690
2025-12-27 16:29:58 +00:00
merge-script
eb0594e23f Merge bitcoin/bitcoin#33891: kernel: Expose reusable PrecomputedTransactionData in script validation
44e006d438 [kernel] Expose reusable PrecomputedTransactionData in script valid (Josh Doman)

Pull request description:

  This PR exposes a reusable `PrecomputedTransactionData` object in script validation using libkernel.

  Currently, libkernel computes `PrecomputedTransactionData` each time `btck_script_pubkey_verify` is called, exposing clients to quadratic hashing when validating a transaction with multiple inputs. By externalizing `PrecomputedTransactionData` and making it reusable, libkernel can eliminate this attack vector.

  I discussed this problem in [this issue](https://github.com/TheCharlatan/rust-bitcoinkernel/issues/46). The design of this PR is inspired by @sedited's comments.

  The PR introduces three new APIs for managing the `btck_PrecomputedTransactionData` object:
  ```c
  /**
   * @brief Create precomputed transaction data for script verification.
   *
   * @param[in] tx_to             Non-null.
   * @param[in] spent_outputs     Nullable for non-taproot verification. Points to an array of
   *                              outputs spent by the transaction.
   * @param[in] spent_outputs_len Length of the spent_outputs array.
   * @return                      The precomputed data, or null on error.
   */
  btck_PrecomputedTransactionData* btck_precomputed_transaction_data_create(
      const btck_Transaction* tx_to,
      const btck_TransactionOutput** spent_outputs, size_t spent_outputs_len) BITCOINKERNEL_ARG_NONNULL(1);

  /**
   * @brief Copy precomputed transaction data.
   *
   * @param[in] precomputed_txdata  Non-null.
   * @return                      The copied precomputed transaction data.
   */
  btck_PrecomputedTransactionData* btck_precomputed_transaction_data_copy(
      const btck_PrecomputedTransactionData* precomputed_txdata) BITCOINKERNEL_ARG_NONNULL(1);

  /**
   * Destroy the precomputed transaction data.
   */
  void btck_precomputed_transaction_data_destroy(btck_PrecomputedTransactionData* precomputed_txdata);
  ```

  The PR also modifies `btck_script_pubkey_verify` so that it accepts `precomputed_txdata` instead of `spent_outputs`:
  ```c
  /**
   * @brief Verify if the input at input_index of tx_to spends the script pubkey
   * under the constraints specified by flags. If the
   * `btck_ScriptVerificationFlags_WITNESS` flag is set in the flags bitfield, the
   * amount parameter is used. If the taproot flag is set, the precomputed data
   * must contain the spent outputs.
   *
   * @param[in] script_pubkey      Non-null, script pubkey to be spent.
   * @param[in] amount             Amount of the script pubkey's associated output. May be zero if
   *                               the witness flag is not set.
   * @param[in] tx_to              Non-null, transaction spending the script_pubkey.
   * @param[in] precomputed_txdata Nullable if the taproot flag is not set. Otherwise, precomputed data
   *                               for tx_to with the spent outputs must be provided.
   * @param[in] input_index        Index of the input in tx_to spending the script_pubkey.
   * @param[in] flags              Bitfield of btck_ScriptVerificationFlags controlling validation constraints.
   * @param[out] status            Nullable, will be set to an error code if the operation fails, or OK otherwise.
   * @return                       1 if the script is valid, 0 otherwise.
   */
  int btck_script_pubkey_verify(
      const btck_ScriptPubkey* script_pubkey,
      int64_t amount,
      const btck_Transaction* tx_to,
      const btck_PrecomputedTransactionData* precomputed_txdata,
      unsigned int input_index,
      btck_ScriptVerificationFlags flags,
      btck_ScriptVerifyStatus* status) BITCOINKERNEL_ARG_NONNULL(1, 3);
  ```

  As before, an error is thrown if the taproot flag is set and `spent_outputs` is not provided in `precomputed_txdata` (or `precomputed_txdata` is null). For simple single-input non-taproot verification, `precomputed_txdata` may be null, and the kernel will construct the precomputed data on-the-fly.

  Both the C++ wrapper and the test suite are updated with the new API. Tests cover both `precomputed_txdata` reuse and nullability.

  Appreciate feedback on this concept / approach!

ACKs for top commit:
  sedited:
    Re-ACK 44e006d438
  stringintech:
    ACK 44e006d

Tree-SHA512: 1ed435173e6ff4ec82bc603194cf182c685cb79f167439a442b9b179a32f6c189c358f04d4cb56d153fab04e3424a11b73c31680e42b87b8a6efcc3ccefc366c
2025-12-27 16:20:43 +00:00
merge-script
e703360577 Merge bitcoin/bitcoin#32997: index: Deduplicate HashKey / HeightKey handling
5646e6c0d3 index: restrict index helper function to namespace (Martin Zumsande)
032f3503e3 index, refactor: deduplicate LookUpOne (Martin Zumsande)
a67d3eb91d index: deduplicate Hash / Height handling (Martin Zumsande)

Pull request description:

  The logic for `DBHashKey` / `DBHeightKey` handling and lookup of entries is shared by `coinstatsindex` and `blockfilterindex`, leading to many lines of duplicated code. De-duplicate this by moving the logic to `index/db_key.h` (using templates for the index-specific `DBVal`).

ACKs for top commit:
  fjahr:
    re-ACK 5646e6c0d3
  furszy:
    utACK 5646e6c0d3
  sedited:
    ACK 5646e6c0d3

Tree-SHA512: 6f41684d6a9fd9bb01239e9f2e39a12837554f247a677eadcc242f0c1a2d44a79979f87249c4e0305ef1aa708d7056e56dfc40e1509c6d6aec2714f202fd2e09
2025-12-27 16:18:34 +00:00
merge-script
ec4ff99a22 Merge bitcoin/bitcoin#33892: policy: allow <minrelay txns in package context if paid for by cpfp
e44dec027c add release note about supporing non-TRUC <minrelay txns (Greg Sanders)
1488315d76 policy: Allow any transaction version with < minrelay (Greg Sanders)

Pull request description:

  Prior to cluster mempool, a policy was in place that
  disallowed non-TRUC transactions from being
  TX_RECONSIDERABLE in a package setting if it was below
  minrelay. This was meant to simplify reasoning about mempool
  trimming requirements with non-trivial transaction
  topologies in the mempool. This is no longer a concern
  post-cluster mempool, so this is relaxed.

  In effect, this makes 0-value parent transactions relayable
  through the network without the TRUC restrictions and
  thus the anti-pinning protections.

ACKs for top commit:
  ajtowns:
    ACK e44dec027c - lgtm
  ismaelsadeeq:
    ACK e44dec027c

Tree-SHA512: 6fd1a2429c55ca844d9bd669ea797e29eca3f544f0b5d3484743d3c1cdf4364f7c7a058aaf707bcfd94b84c621bea03228cb39487cbc23912b9e0980a1e5b451
2025-12-27 16:13:19 +00:00
merge-script
48c9ba1e97 Merge bitcoin/bitcoin#34137: test: Avoid hard time.sleep(1) in feature_init.py
fa727e3ec9 test: Avoid hard time.sleep(1) in feature_init.py (MarcoFalke)

Pull request description:

  Using a hard-coded `time.sleep` in the tests is usually confusing and brittle. For example, the one in `break_wait_test`:

  * Is confusing, because it does not explain why it is needed.
  * On fast hardware will just lead to a useless delay.
  * On slow hardware may lead to an intermittent, and confusing test failure.

  Fix all issues by replacing it with the proper condition to wait on.

ACKs for top commit:
  Sjors:
    utACK fa727e3ec9
  rkrux:
    tACK fa727e3
  janb84:
    tACK fa727e3ec9

Tree-SHA512: 7b59496a1b9b8044548423ad517ff03e98521685cf65499cd0ef499d6fd3d72ad374c92ca815436675ed6ae7be508a5a1afce699b804a384d7aee6a195d8d972
2025-12-27 16:07:16 +00:00
MarcoFalke
fab300b378 test: Enable ruff E713 lint 2025-12-26 08:19:34 +01:00
David Gumberg
11ce5cf799 scripted-diff: refactor: wallet: Delete IsCrypted
This function is a duplicate of HasEncryptionKeys().

-BEGIN VERIFY SCRIPT-
sed -i '/bool IsCrypted() const;/d' src/wallet/wallet.h
sed -i '/^bool CWallet::IsCrypted() const$/,/^}$/{/^}$/N;d;}' src/wallet/wallet.cpp
sed -i --regexp-extended 's/IsCrypted\(\)/HasEncryptionKeys()/g' $(git ls-files '*.cpp' '*.h')
-END VERIFY SCRIPT-
2025-12-24 11:09:15 -08:00
Josh Doman
44e006d438 [kernel] Expose reusable PrecomputedTransactionData in script valid 2025-12-23 18:48:56 -05:00