Skip to content

Conversation

@crazecdwn
Copy link
Owner

No description provided.

fanquake and others added 29 commits December 27, 2025 16:13
… for by cpfp

e44dec0 add release note about supporing non-TRUC <minrelay txns (Greg Sanders)
1488315 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 e44dec0 - lgtm
  ismaelsadeeq:
    ACK e44dec0

Tree-SHA512: 6fd1a2429c55ca844d9bd669ea797e29eca3f544f0b5d3484743d3c1cdf4364f7c7a058aaf707bcfd94b84c621bea03228cb39487cbc23912b9e0980a1e5b451
5646e6c index: restrict index helper function to namespace (Martin Zumsande)
032f350 index, refactor: deduplicate LookUpOne (Martin Zumsande)
a67d3eb 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 5646e6c
  furszy:
    utACK 5646e6c
  sedited:
    ACK 5646e6c

Tree-SHA512: 6f41684d6a9fd9bb01239e9f2e39a12837554f247a677eadcc242f0c1a2d44a79979f87249c4e0305ef1aa708d7056e56dfc40e1509c6d6aec2714f202fd2e09
… script validation

44e006d [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](sedited/rust-bitcoinkernel#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 44e006d
  stringintech:
    ACK 44e006d

Tree-SHA512: 1ed435173e6ff4ec82bc603194cf182c685cb79f167439a442b9b179a32f6c189c358f04d4cb56d153fab04e3424a11b73c31680e42b87b8a6efcc3ccefc366c
…pted()

11ce5cf 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 11ce5cf 🔀
  billymcbip:
    utACK [11ce5cf](11ce5cf)
  polespinasa:
    code review tACK 11ce5cf
  rkrux:
    crACK 11ce5cf

Tree-SHA512: 24bd9fedb17fab092346953558b25a2e4181d8f3750cedd0ecf3939291216190d442a38c93aa6829a3a88e60d94b90cada42136c24fd0fabe367994fc1e89690
…asts

fa66e2d 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 #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 fa66e2d
  rkrux:
    ACK fa66e2d

Tree-SHA512: 13c9c59ad021ea03cdabe10d58850cef96d792634c499e62227cc2e7e5cace066ebd9a8ef3f979eaba98cadf8a525c6e6df909a07115559c0450bd9fc3a9763e
It belonged to the note removed in #33892
337b4a2 Remove stale rationale paragraph (flack)

Pull request description:

  It belonged to the note removed in #33892

ACKs for top commit:
  instagibbs:
    ACK 337b4a2

Tree-SHA512: 3cb1d3b87aa42ff92130af10ce2c286c0d83cbfdf17096d47b540ffe8e1a9a4727aedb8d477599fbff0002d7e262a6a52549dcccfa38dbe61281c221cf26cae2
ba6315d contrib: remove copyright_header.py (fanquake)
3e4765e 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 ba6315d
  rkrux:
    crACK [ba6315d](ba6315d)
  janb84:
    ACK ba6315d

Tree-SHA512: c0d6ed0a71803c5ae6c70260fa4162bea1f1b24cf6fc9b58e018bb9d6a673d2d59c25a17deda067a268024e3757081e3a214680e1e626d71c0debc5066d5f623
fab1f4b 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 fab1f4b
  pablomartin4btc:
    ACK fab1f4b
  glozow:
    ACK fab1f4b

Tree-SHA512: b03c888ec07a8bdff25f7ded67f253b2a8edd83adf08980416e2ac8ac1b36ad952cc5828be833d19f64a55abab62d7a1c6f181bc5f1388ed08cc178b4aaec6ee
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.
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.
`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.
719158d depends: capnp 1.3.0 (fanquake)

Pull request description:

  Update capnp in depends to `1.3.0`.

  Changes: capnproto/capnproto@release-1.2.0...release-1.3.0.

ACKs for top commit:
  Sjors:
    ACK 719158d
  sedited:
    ACK 719158d
  hebasto:
    ACK 719158d. 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
08ed802 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 08ed802
  maflcko:
    lgtm ACK 08ed802

Tree-SHA512: e4eeb9a95489b4c46fbb7a0dbeb549d70a2b087ab6400cc6ba89cbfc015b40e580fab8a68913499af7c83a988e66642dcc7a222b70d2eda5c57f4a02b5a556ae
84d8c52 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](#33555) minimum requirement.

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

Tree-SHA512: 06644733702d72687a2e860cf561c9ca39a3cf1d7c339c94f2b87d36b530776f7e7d0f7e3d22cd858ee8639bd4e85c47081602cbe829c7406cdcd65380e84130
95ef0fc test: ensure clean orphanage before continuing (Greg Sanders)
25e84d3 test: change low fee parents to 0-fee (Greg Sanders)

Pull request description:

  Resolves #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 95ef0fc

Tree-SHA512: 4952062cb46b0e9f665de454718d093d3eac17532e4330caf80290f82b130614db3ccc5e5abf06f1e66237b9ba53ecdd0d13e4d5b09812f5c91db00b948ebb6b
b23b901 doc: update copyright year (fanquake)

Pull request description:

  Bump in the places that need bumping.

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

Tree-SHA512: 25a546a060447a5ad37f8cc2e1d8e85420a1e38980fb09124170112ccbd1a311c9e99f31e712575b5d4f5d45524b2e2de15122e7021f3eb68c9d0dce534a37c9
This teaches the test framework about the bench executable, which is
required for the next commit.
…FormedPackage`

658d381 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 658d381
  instagibbs:
    ACK 658d381

Tree-SHA512: 8b86dda7e2e1f0d48947ff258f0a3b6ec60676f54d4b506604d24e15c8b6465358ed2ccf174c7620125f5cad6bfc4df0bc482d920e5fc4cd0e1d72a9b16eafa5
…endent

77c9b3c 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 77c9b3c
  dergoegge:
    Code review ACK 77c9b3c

Tree-SHA512: fbc821c4790dd9ac125046a842498e0d9a48549d1c8ef150bce2193ee62bee9c3bfd4b17ce278411102dd200dc9ad86a176ecae29ca1667bb14d6f90ad67e01d
Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
bd730cb doc: archive release notes for v30.1 (fanquake)

Pull request description:

  (fixing the `.x` typo)

ACKs for top commit:
  marcofleon:
    ACK bd730cb

Tree-SHA512: da46de525b6970a627435f0697e464514466bbd2ed368084532c920aa889908afaf8c4708362404a038ec2a14f9b50e7bac5e66faab9daff10f799f07c97028a
billymcbip and others added 30 commits January 22, 2026 13:14
- CTxMemPool::removeUnchecked description comment is stale and incorrect
  after cluster mempool.
  This commit fixes the issue by deleting the stale comment and describing
  only the implicit behaviour triggered by the method.
Introduces btck_BlockHeader type with accessor methods and btck_chainstate_manager_process_block_header() for validating headers without full blocks. Also, adds btck_chainstate_manager_get_best_entry() to query the header with most cumulative proof-of-work.

Co-authored-by: TheCharlatan <seb.kung@gmail.com>
1137deb doc: mempool: fix  `removeUnchecked` incorrect comment (ismaelsadeeq)

Pull request description:

  `CTxMemPool::removeUnchecked` description comment is stale and incorrect; the behaviour being described no longer applies in the post-cluster world.  This PR is a simple fix that attempts to correctly describe what is being done in removeUnchecked.

ACKs for top commit:
  instagibbs:
    ACK 1137deb
  sipa:
    ACK 1137deb

Tree-SHA512: e410be57a83df50df01fcd6d7b07d08f0fe5a2abd229974f1ad269bb2e301608fd0d3912af349e2971f9a8abdbaa8e90c46d4832ec7b6858639642742b31a618
Replace the C-style casting with C++ reinterpret_cast
d94d7b1 guix: stop passing depends sources to codesigning (fanquake)

Pull request description:

  I think this is just a copy-pasta from the build container (which has existed since this file was introduced in 38eb91e). I don't see why we'd need the depends sources available when performing codesigning.

ACKs for top commit:
  hebasto:
    ACK d94d7b1, I have reviewed the code and it looks OK.
  willcl-ark:
    ACK d94d7b1
  sedited:
    tACK d94d7b1

Tree-SHA512: 972b15aa022b79602f40c198187a54d85ceeee0014fd2232ca967bb52e4624cbb85b3ef1cdeac3ccd8c7b337a13c3be9c90291141495c8136a8e72ad2cd4ec4a
https://httpwg.org/specs/rfc9110.html#rfc.section.5.1
Field names in HTTP headers are case-insensitive. These
structs will be used in the headers map to search by key.

In libevent field names are also converted to lowercase for comparison:
  evhttp_find_header()
  evutil_ascii_strcasecmp()
  EVUTIL_TOLOWER_()
HTTP 1.1 responses require a timestamp header with a format
specified (currently) by:
https://datatracker.ietf.org/doc/html/rfc9110#section-5.6.7

This specific format is defined in RFC1123:
https://www.rfc-editor.org/rfc/rfc1123#page-55

The libevent implementation can be referenced in evutil_time.c
evutil_date_rfc1123()
This is a helper struct to parse HTTP messages from data in buffers
from sockets. HTTP messages begin with headers which are
CRLF-terminated lines (\n or \r\n) followed by an arbitrary amount of
body data. Whitespace is trimmed from the field lines but not the body.

https://httpwg.org/specs/rfc9110.html#rfc.section.5
Also, fixup iwyu warnings in the util module.

Also, fixup a typo.

The moved part can be reviewed with the git option:
--color-moved=dimmed-zebra
8b9d30e bench/test: clarify merkle bench and witness test intent (Lőrinc)

Pull request description:

  Follow-up to #32497.

  Clarify why the witness merkle test uses an odd leaf count (it exercises leaf duplication in `ComputeMerkleRoot()`), and make the coinbase witness hash initialization explicit.

  Also simplify the leaf-copy loop in the `MerkleRoot` benchmark for readability.

  No production code is changed in this follow-up, for simplicity and safety.

ACKs for top commit:
  optout21:
    ACK 8b9d30e
  maflcko:
    lgtm ACK 8b9d30e
  achow101:
    ACK 8b9d30e
  w0xlt:
    ACK 8b9d30e
  danielabrozzoni:
    tACK 8b9d30e

Tree-SHA512: 6efca7c19ebf96bb8d0def4217ed30d3b74b58a7be15566967e98aba9b03aaddd0e0ebb3b8f43130b5f397a7d9eed0470a48a55438f440e0bceefb87edd16b27
This is likely slightly slower, but this was the last place we were using
epochs instead of sets to deduplicate, and this is only used by the RPC code
and in tests, and should not be CPU-performance critical. Eliminating this
allows us to save 8 bytes in CTxMemPoolEntry.

Co-Authored-By: Pieter Wuille <bitcoin-dev@wuille.net>
c9ce1c7 test: Fix P2PK script test (billymcbip)

Pull request description:

  I found another script_tests case that isn't behaving the way it was meant to. It's a P2PK spend where we add an `OP_NOP8` to the scriptSig to make it non-push-only. The test should check that [`scriptSig.IsPushOnly()`](https://github.com/bitcoin/bitcoin/blob/691dc830c669061923a7eec677415013f75fd5d8/src/script/interpreter.cpp#L2055) is only enforced in P2SH mode when the scriptPubKey actually matches the P2SH pattern. To test this, we need to **turn on the P2SH flag**.

ACKs for top commit:
  sipa:
    ACK c9ce1c7
  darosior:
    utACK c9ce1c7

Tree-SHA512: 0af1d7b4651478349abc97cf0c009488cf5af5f97135382f7dd37cef0ef9b563192244330899a54ee7e0296bf03ba702e37a7aa15248c5c0ab4745095efc2402
…targets

fab2f3d fuzz: Exclude too expensive inputs in descriptor_parse targets (MarcoFalke)

Pull request description:

  Accepting "expensive" fuzz inputs which have no real use-case is problematic, because it prevents the fuzz engine from spending time on the next useful fuzz input.

  For example, those will take several seconds (!) and the flamegraph shows that base58 encoding is the cause:

  ```
  curl -fLO 'https://github.com/bitcoin-core/qa-assets/raw/b5ad78e070e4cf36beb415d7b490d948d70ba73f/fuzz_corpora/mocked_descriptor_parse/f5abf41608addcef3538da61d8096c2050235032'
  curl -fLO 'https://github.com/bitcoin-core/qa-assets/raw/b5ad78e070e4cf36beb415d7b490d948d70ba73f/fuzz_corpora/descriptor_parse/78cb3175467f53b467b949883ee6072e92dbb267'

  FUZZ=mocked_descriptor_parse ./bld-cmake/bin/fuzz ./f5abf41608addcef3538da61d8096c2050235032
  FUZZ=descriptor_parse ./bld-cmake/bin/fuzz ./78cb3175467f53b467b949883ee6072e92dbb267
  ```

  This will also break 32-bit fuzzing, see #34110 (comment).

  Fix all issues by checking for `HasTooLargeLeafSize`.

  Sorry for creating several pull requests to fix this class of issue, but I think this one should be the last one. 😅

ACKs for top commit:
  brunoerg:
    reACK fab2f3d
  frankomosh:
    re-ACK fab2f3d

Tree-SHA512: 4ecf98ec4adc39f6e014370945fb1598cdd3ceba60f7209b00789ac1164b6d20e82a69d71f8419d9a40d57ee3fea36ef593c47fe48b584b6e8344c44f20a15c1
1911db8 string: add LineReader (Matthew Zipkin)
ee62405 time: implement and test RFC1123 timestamp string (Matthew Zipkin)
eea3878 string: add AsciiCaseInsensitive{KeyEqual, Hash} for unordered map (Matthew Zipkin)
4e300df string: add `base` argument for ToIntegral to operate on hexadecimal (Matthew Zipkin)
0b0d912 Modernize GetBindAddress() (Matthew Zipkin)
a0ca851 Make GetBindAddress() callable from outside net.cpp (Matthew Zipkin)

Pull request description:

  This is a component of [removing libevent as a dependency of the project](#31194). It is the first six commits of #32061 and provides a string-parsing utility (`LineReader`) that is also consumed by #34158.

  These are the functions that are added / updated for HTTP and Torcontrol:

  - `GetBindAddress()`: Given a socket, provides the bound address as a CService. Currently used by p2p but moved from `net` to `netbase` so other modules can call it.
  - `ToIntegral()`: Already used to parse numbers from strings, added new argument `base = 10` so it can also be used to parse hexadecimal integers. HTTP chunked transfer-encoding uses hex-encoded integers to specify payload size: https://datatracker.ietf.org/doc/html/rfc7230.html#section-4.1
  - `AsciiCaseInsensitive` comparators: Needed to store HTTP headers in an `unordered_map`. Headers are key-value pairs that are parsed with case-insensitive keys: https://httpwg.org/specs/rfc9110.html#rfc.section.5.1
  - `FormatRFC1123DateTime()`: The required datetime format for HTTP headers (e.g. `Fri, 31 May 2024 19:18:04 GMT`)
  - `LineReader`: Fields in HTTP requests are newline-terminated. This struct is given an input buffer and provides methods to read lines as strings.

ACKs for top commit:
  maflcko:
    review ACK 1911db8 👲
  furszy:
    utACK 1911db8
  sedited:
    ACK 1911db8

Tree-SHA512: bb8d3b7b18f158386fd391df6d377c9f5b181051dc258efbf2a896c42e20417a1b0b0d4637671ebd2829f6bc371daa15775625af989c19ef8aee76118660deff
9a9d797 kernel: Add support for block headers (yuvicc)
b851ff6  kernel: Add Handle/View pattern for BlockValidationState (yuvicc)

Pull request description:

  Adds a new `btck_BlockHeader` type and associated functions to create, access, and validate block headers. Block headers will have their own type (`btck_BlockHeader`) that can be created from raw data, copied, and queried for all the standard header fields (hash, prev hash, timestamp, bits, version, nonce). We can also extract headers from full blocks or block tree entries.

  The first commit here refactors `BlockValidationState` to use Handle/View pattern so external code can own them, which is required for the header processing in the API.

   #### New Block Header API

    - **`btck_BlockHeader` type**: Opaque handle for block headers
    - **Header methods**:
      - `btck_block_header_create()`: Create header from 80-byte serialized data
      - `btck_block_header_copy()`: Copy block headers
      - `btck_block_header_destroy()`: Destroy header object
      - `btck_block_header_get_hash()`: Calculate block hash
      - `btck_block_header_get_prev_hash()`: Get previous block hash
      - `btck_block_header_get_timestamp()`: Get block timestamp
      - `btck_block_header_get_bits()`: Get difficulty target (compact format)
      - `btck_block_header_get_version()`: Get block version
      - `btck_block_header_get_nonce()`: Get proof-of-work nonce

      - `btck_block_get_header()`: Extract header from a full block
      - `btck_block_tree_entry_get_block_header()`: Get header associated with a block tree entry

    - **Header Processing Methods:**
      - **`btck_chainstate_manager_process_block_header()`**: Validates and processes a block header without requiring the full block. This performs proof-of-work verification, timestamp validation, and updates the internal chain state.
      - **`btck_chainstate_manager_get_best_entry()`**: Returns the block tree entry with the most cumulative proof-of-work.

  Why `btck_chainstate_manager_get_best_entry()` is included alongside header validation? Just as we have logic to get the tip for block validation (so you can request more blocks extending your best from your peers), we need the equivalent for header validation. To make header validation worthwhile, knowing what the best current header is seems useful—it tells you what headers to request next from peers.

    ### Testing

    Added tests in `test_kernel.cpp` that cover creating headers from raw data, extracting all header fields, and processing headers through the chainstate manager.

    CC sedited

ACKs for top commit:
  stringintech:
    re-ACK 9a9d797
  sedited:
    Re-ACK 9a9d797
  janb84:
    ACK 9a9d797

Tree-SHA512: 1dde9ef860543c906d1bb5e604f0d2956e7382fcbb55090686261b2277270a1fd3826f02ecf1749b2774da66e88f686c7845172b4c68b62259e7a7aee0825fa2
Facilitate use on distros that might have 'tar' as something else, such
as 'gtar', i.e Chimera.
A chrono time point is a bit more type-safe than a raw i64.

Also, add a dedicated helper for plain chrono durations.
4073545 Remove unused epochguard.h (Suhas Daftuar)
1a8494d Rework CTxMemPool::GetChildren() to not use epochs (Suhas Daftuar)

Pull request description:

  Since #33591, the epoch-based graph traversal optimization logic is only used for `CTxMempool::GetChildren()`, a function that is only used in RPC code and tests. Rewrite it without epochs, and remove `util/epochguard.h` itself, as that was its last use.

  This allows us to reduce per-transaction memory usage by 8 bytes, for no material loss. With the new TxGraph-based mempool implementation, I also don't foresee future uses for it, as TxGraph can do even better by using BitSet-based traversal tracking.

ACKs for top commit:
  ajtowns:
    ACK 4073545
  instagibbs:
    ACK 4073545
  l0rinc:
    code review ACK 4073545

Tree-SHA512: 7ce7c04835cd2425a71c4fd47f316b6fb7381caa27383de7ecc4aa81100fcf7bc5e062699b307c08e0b853b35f06710d9ac761d6e660af9f9331e708d36f2fe0
The extra leading `=` or missing trailing `=` prevented clang-tidy's `bugprone-argument-comment` check from validating the parameter name, as it only matches comments formatted strictly as `/*arg=*/` (see https://clang.llvm.org/extra/clang-tidy/checks/bugprone/argument-comment.html).
be2b48b test: allow overriding tar in get_previous_releases (fanquake)

Pull request description:

  Facilitate use on distros that might have `tar` as something else, such as `gtar`, i.e Chimera.

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

Tree-SHA512: e5da14ef17f37dc52e438f191efbe9041477246bab04b9e166cf2104389e97bfc6b41005c9d79a99f193e8d7b24ecd32dbd8344c65878e92fd94c77d3efbbe8c
…en not available or detecting

b261100 [qt] Set peer version and subversion to N/A when not available or detecting (WakeTrainDev)

Pull request description:

  In the debug console peer detail window, display "N/A" for the User Agent and Version when the peer is still detecting or the information is unavailable, instead of retaining the previous values.

ACKs for top commit:
  maflcko:
    lgtm ACK b261100
  luke-jr:
    utACK b261100

Tree-SHA512: ffcba716fe6173062fe00e2d428d41bbdcaebfe8c76c804519e46a448ade2785ae32efb1a30322adc19cf29e07ea8ab4d7593ef5a17b6c418c8dd77b381e4f77
fa15a8d doc: Explain that low-effort pull requests may be closed (MarcoFalke)

Pull request description:

  Lately, there seems to be a rise in low-effort pull requests. For example, where a contributor does not seem to understand the changes they are submitting, or it becomes clear that they have not tested the changes at all.

  I don't think such pull requests are helpful, as they extract precious review time, which could be better spent on reviewing pull requests by reviewers who care about understanding the changes they are submitting, and who ensure their changes are sound and tested.

  So document that such low-effort pull request may be closed.

ACKs for top commit:
  l0rinc:
    ACK fa15a8d
  willcl-ark:
    ACK fa15a8d
  dergoegge:
    ACK fa15a8d
  pinheadmz:
    ACK fa15a8d

Tree-SHA512: ba880f61c90c95e1e9007e337bad1a612a53ca85448f0ebfe97b34139489f22e5f709b8a0e302b11f71213e3b7863ab36ebd89b5c11cd550022d96493f917dd7
ccf9172 util: Remove `FilterHeaderHasher` (rustaceanrob)

Pull request description:

  With respect to `std::unordered_map` documentation, the `Hash` type
  defined in the template is over the `Key` and not `T`, the value. This
  hasher is incorrectly named as the `FilterHeader` is the value within this map.
  I consider this a bug as opposed to a refactor as the key and value
  relationship is implied to be `filter header -> block hash` when it is
  the opposite.

  Further, the hasher for the key already exists via `BlockHasher`.

  ref: https://en.cppreference.com/w/cpp/container/unordered_map.html

ACKs for top commit:
  andrewtoth:
    ACK ccf9172
  maflcko:
    lgtm ACK ccf9172
  ismaelsadeeq:
    ACK ccf9172 👍🏾

Tree-SHA512: 607602391bf337d4e25b04a6a643fa32c3ab4599009b181b46ecdb0705e8ff2af89a6192042453c9e8e44abcb2150589019f02c5c944ecdff41322c3e0ad45ac
…meDuration()

eeee375 fuzz: Return chrono point from ConsumeTime(), Add ConsumeDuration() (MarcoFalke)
faa5a9e fuzz: Use min option in ConsumeTime (MarcoFalke)

Pull request description:

  Returning a raw i64 is a bit confusing when it comes to chrono types. For example, in the addrman fuzz tests, the `time_penalty` is not a time point, but a duration.

  Also, all call-sites assume second resolution right now, so document that better by returning `NodeSeconds` from `ConsumeTime(...)` and `std::chrono::seconds` from `ConsumeDuration(...)`.

ACKs for top commit:
  l0rinc:
    ACK eeee375
  Crypt-iQ:
    crACK eeee375

Tree-SHA512: 25dd779a1bf79fa42c6e69db0f0593ad4daa4c0d746e8e82a26bdd65391a27c38e484431056d4e2207b542c511a71cb536c259809728a7166b8d304c0490e321
…g-prefix-map`

fa37928 build: Temporarily remove confusing and brittle -fdebug-prefix-map (MarcoFalke)

Pull request description:

  The compiler option `-fdebug-prefix-map` is unconditionally set by the build system. This is problematic for many reasons:

  * Users and devs have no easy way to disable it without modifying the build system source code
  * The mapping is broken since the cmake migration, and requires manual fixups such as #31204 or #31957

  Fix all issues by temporarily removing it.

  Though, the option is kept for the guix build, so that no change in behavior is observed for the release binaries.

  Fixes #31957
  Fixes #31204

  The option can be added back in the future, if there is any need to. Though, adding it back should ideally work out of the box, or at least provide easy workarounds for all commonly used tooling.

ACKs for top commit:
  pinheadmz:
    ACK fa37928
  l0rinc:
    ACK fa37928
  hebasto:
    ACK fa37928.

Tree-SHA512: 5c76faab36ec516b286c2b5b2404e1488c0c4fbc678904593b0acb9c8da9b1db1b41436a22e6aa2f2671650288ccf635554773ef3144dc1df6ea838afce07ecb
a73a3ec doc: fix invalid arg name hints for bugprone validation (Lőrinc)

Pull request description:

  The extra leading `=` or missing trailing `=` prevented clang-tidy's `bugprone-argument-comment` check from validating the parameter name, as it only matches comments formatted strictly as `/*parameter_name=*/` (see https://clang.llvm.org/extra/clang-tidy/checks/bugprone/argument-comment.html).

  I have considered doing a scripted diff, but the values I found aren't so numerous and can easily be reviewed manually.

ACKs for top commit:
  b-l-u-e:
    ACK a73a3ec tested and saw that argument comments now use the strict "/*param=*/"  format required by bugprone-argument-comment
  Sjors:
    utACK a73a3ec
  maflcko:
    review ACK a73a3ec 🍦

Tree-SHA512: 31177934d645116f381668a0f945028d7e04fab1fc6185dd0e3b7451aab71f89f1e4dd07246db667d1c4734eea3e5d73433c8b0e09181b3ece47dacc8677401e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.