30178 Commits

Author SHA1 Message Date
Hennadii Stepanov
94a692b6aa
cmake: Add missed USDT::headers 2026-02-05 13:46:20 +00:00
Hennadii Stepanov
d73378ffcc
cmake: Add missed Boost::headers 2026-02-05 13:46:14 +00:00
Hennadii Stepanov
eb97250421
Merge bitcoin/bitcoin#34496: build: don't pass on boost dependency to kernel consumers
a50d0b6720f300987d2b3d82f4fb3a2336259887 build: don't pass on boost dependency to kernel consumers (Cory Fields)

Pull request description:

  This is unnecessary now that the kernel now exports a (boost-less) API.

  Noticed while slimming down boost dependencies in #34495.

ACKs for top commit:
  stickies-v:
    ACK a50d0b6720f300987d2b3d82f4fb3a2336259887
  hebasto:
    ACK a50d0b6720f300987d2b3d82f4fb3a2336259887, I have reviewed the code and it looks OK. I tested it by applying the Boost-specifc commits from https://github.com/bitcoin/bitcoin/pull/34143 and building with depends.

Tree-SHA512: e2d12356f41dd51dd729362121a33bd4f395821d53dd9a0bb0d5d6a53aba2ca2064e0709d9799dc6751b3d61ea576d2efc0e28296fdba26f2809dbcb0feabe44
2026-02-05 12:18:51 +00:00
merge-script
9d76947294
Merge bitcoin/bitcoin#34464: Change BlockRequestAllowed() to take ref (minor refactor)
1f8f7d477ae0d33bd96f7936889c17bd40805fb9 Change BlockRequestAllowed() to take ref (optout)

Pull request description:

  As [suggested here](https://github.com/bitcoin/bitcoin/pull/34416#discussion_r2745302958), a minor refactor of `PeerManagerImpl::BlockRequestAllowed()` to take reference parameter (instead of pointer). The motivation is to make the code safer, by minimizing the risk of null-dereference, and to be more consistent.
  The change is local to the `PeerManagerImpl::BlockRequestAllowed()` class.
  Related to #34440.

ACKs for top commit:
  maflcko:
    review ACK 1f8f7d477ae0d33bd96f7936889c17bd40805fb9 🎐
  l0rinc:
    tested ACK 1f8f7d477ae0d33bd96f7936889c17bd40805fb9
  stickies-v:
    ACK 1f8f7d477ae0d33bd96f7936889c17bd40805fb9

Tree-SHA512: 9c2de2d3e7d067e018db7ec54c79f512ccc1da54574d4fb362f6697ee6e235783779d7094cf20856cd34e08a1dbc74609d8351fe7b2287cd8ec0c836ef07be19
2026-02-05 10:56:37 +00:00
ismaelsadeeq
243e48cf49
fees: delete unused dummy field
- This commit deletes a dummy field that is
  "dummy" and unused.
2026-02-05 10:52:56 +00:00
ismaelsadeeq
fc4fbda42a
fees: bump fees file version 2026-02-05 10:52:55 +00:00
ismaelsadeeq
b54dedcc85
fees: reduce MIN_BUCKET_FEERATE to 100
- The DEFAULT_MIN_RELAY_TX_FEE has been reduced to
  100 in v30. This change updates block policy fee estimator
  to reflect that change.
2026-02-05 10:52:51 +00:00
Vasil Dimov
2cb7e99dee
test: also reset CConnman::m_private_broadcast in tests
Member variables of `CConnman::m_private_broadcast` (introduced in
https://github.com/bitcoin/bitcoin/pull/29415) could influence the tests
which creates non-determinism if the same instance of `CConnman` is used
for repeated test iterations.

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

Reported in
https://github.com/bitcoin/bitcoin/issues/34476#issuecomment-3849088794
2026-02-05 11:31:20 +01:00
Vasil Dimov
91b7c874e2
test: add ConnmanTestMsg convenience method Reset() 2026-02-05 09:43:43 +01:00
Murch
54d0393058
FUZZ: Test that BnB finds best solution
BnB’s solution is the input set with the lowest waste score, excluding
any supersets of other solution candidates.
This fuzz test compares a brute force search with the BnB result to
ensure that BnB succeeds.
2026-02-04 13:59:35 -08:00
Ava Chow
4ae00e9a71
Merge bitcoin/bitcoin#32636: Split CWallet::Create() into CreateNew and LoadExisting
db2effaca4cf82bf806596d16f9797d3692e2da7 scripted-diff: refactor: CWallet::Create() -> CreateNew() (David Gumberg)
27e021ebc0dd3517a71f3ddb38ed265a19693d4c wallet: Correctly log stats for encrypted messages. (David Gumberg)
d8bec61be233b9cb6d5db886e8f1c1f058288fb5 wallet: remove loading logic from CWallet::Create (David Gumberg)
f35acc893fb3378b2ad39608fe254d33af6cce9f refactor: wallet: Factor out `WriteVersion()` from `PopulateWalletFromDB()` (David Gumberg)
e12ff8aca049ec7b054cb3047a167c7ce8dbd421 test: wallet: Split create and load (David Gumberg)
70dbc79b09acf7b1515532ee20c7533c938ffb70 wallet: Use CWallet::LoadExisting() for loading existing wallets. (David Gumberg)
ae66e011646266abb67b31027bc29e0ce1d08ad4 wallet: Create separate function for wallet load (David Gumberg)
bc69070416c62a88d8f4029280ec10d6f9ec8d20 refactor: Wallet stats logging in its own function (David Gumberg)
a9d64cd49c69dafd6496ccb5aef4cd6d8898966b wallet: Remove redundant birth time update (David Gumberg)
b4a49cc7275efc16d4a4179ed34b50de5bb7367e wallet: Move argument parsing to before DB load (David Gumberg)
b15a94a618c53041e97ccfface3045a0642777e1 refactor: Split out wallet argument loading (David Gumberg)
a02c4a82d88a3e9a24ec2aa0b828b8cc533dde58 refactor: Move -walletbroadcast setting init (David Gumberg)
411caf72815bdf2e176e790a4c63f745517c4bb4 wallet: refactor: PopulateWalletFromDB use switch statement. (David Gumberg)
a48e23f566ccaf9b81fe0684885972d9ee34afd3 refactor: wallet: move error handling to PopulateWalletFromDB() (David Gumberg)
0972785fd723b9b3c84844bf999d6e08e163ef9d wallet: Delete unnecessary PopulateWalletFromDB() calls (David Gumberg)
f0a046094e4c4b5f3af0e453492077f4911e0132 scripted-diff: refactor: CWallet::LoadWallet->PopulateWalletFromDB (David Gumberg)

Pull request description:

  This PR is mostly a refactor which splits out logic used for creating wallets and for loading wallets, both of which are presently contained in `CWallet::Create()` into `CWallet::CreateNew()` and `CWallet::LoadExisting()`

  The real win of this PR is that `CWallet::Create()` uses a very bad heuristic for trying to guess whether or not it is supposed to be creating a new wallet or loading an existing wallet:

  370c592612/src/wallet/wallet.cpp (L2882-L2885)

  This heuristic assumes that wallets with no `ScriptPubKeyMans` are being created, which sounds reasonable, but as demonstrated in #32112 and #32111, this can happen when the user tries to load a wallet file that is corrupted, both issues are fixed by this PR and any other misbehavior for wallet files which succeeded the broken heuristic's sniff test for new wallets.

  It was already the case that every caller of `CWallet::Create()` knows whether it is creating a wallet or loading one, so we can avoid replacing this bad heuristic with another one, and just shift the burden to the caller.

ACKs for top commit:
  achow101:
    ACK db2effaca4cf82bf806596d16f9797d3692e2da7
  polespinasa:
    approach ACK db2effaca4cf82bf806596d16f9797d3692e2da7
  w0xlt:
    reACK db2effaca4cf82bf806596d16f9797d3692e2da7
  murchandamus:
    ACK db2effaca4cf82bf806596d16f9797d3692e2da7
  rkrux:
    ACK db2effaca4cf82bf806596d16f9797d3692e2da7

Tree-SHA512: c28d60e0a3001058da3fd2bdbe0726c7ebe742a4b900a1dee2e5132eccc22e49619cb747a99b4032b000eafd4aa2fdd4ec244c32be2012aba809fdc94b5f6ecd
2026-02-04 11:06:36 -08:00
merge-script
d4bc620ad8
Merge bitcoin/bitcoin#34488: refactor: Small style and test fixups for bitcoinkernel
fad9dd1a8891770846f3f98c60bebf2c2bf72e05 test: kernel test fixups (MarcoFalke)
fabb58d42dc203b91f6ec6261f4bac94ee8df0a2 test: Use clang-tidy named args for create_chainman (MarcoFalke)
fa51594c5c0fe27e55d580dfab046e1226c6d83b refactor: Small style fixups in src/kernel/bitcoinkernel.cpp (MarcoFalke)

Pull request description:

  Just some small style and test fixups after https://github.com/bitcoin/bitcoin/pull/30595#pullrequestreview-3420542946

ACKs for top commit:
  stickies-v:
    re-ACK fad9dd1a8891770846f3f98c60bebf2c2bf72e05
  frankomosh:
    Code Review ACK fad9dd1a8891770846f3f98c60bebf2c2bf72e05. All changes are sound refactoring with no functional issues. Nice improvements to readability (named args in create_chainman, span.data(), range checks now properly require non-empty).

Tree-SHA512: 0a92e871b4db75a590acad39672594625e402895bc0d36635d36ec2fe8dce7cc2c5cb6ebf2a92bc14617d94648b84bffb95ff783cea71bd91ac4a9871ef5dbef
2026-02-04 13:48:21 +00:00
merge-script
1e64aeaaec
Merge bitcoin/bitcoin#34295: test: Improve STRICTENC/DERSIG unit tests
4dfb6eef70d719a79904cabc4519d7a725de130a test: Add DERSIG tests to script_tests (billymcbip)
884978f3894ac7d96f113a00bbcce45c9785d44a test: Fix a STRICTENC test in script_tests (billymcbip)
527e8ca7b54515e129484824e4df66b5dafdb45f test: Remove outdated comment in script_tests (billymcbip)

Pull request description:

  1. Remove a comment referencing a file that no longer exists in the codebase: `script_invalid.json`.

  2. Fix a test that isn't implemented as intended. The idea is to test execution order by providing a signature that would cause script failure when parsed. An empty signature does not cause script failure in `CHECKMULTISIG`. Use `OP_1` for the second signature instead of `OP_0`.

  3. Copy existing `STRICTENC` tests and change the flag to `DERSIG`. `DERSIG` is a consensus flag (unlike `STRICTENC`), so it'd be good to have dedicated test cases.

  `script_tests` pass on my end.

ACKs for top commit:
  darosior:
    reACK 4dfb6eef70d719a79904cabc4519d7a725de130a
  sipa:
    ACK 4dfb6eef70d719a79904cabc4519d7a725de130a

Tree-SHA512: aea4aa5199530804561e9f597f69d6cffd7a40d4830919f9371fe97e4d04d8f10e8ed29b91e65e007a3f6e3a38e2881f88dff25831e741ad7592a12ed02b801a
2026-02-04 09:37:56 +00:00
Cory Fields
a50d0b6720 build: don't pass on boost dependency to kernel consumers
This is unnecessary now that the kernel now exports a (boost-less) API.
2026-02-03 21:36:49 +00:00
Ava Chow
3532e24213
Merge bitcoin/bitcoin#32748: fees: fix noisy flushing log
02b5f6078d65c3a2f9ba8b30474d8201516c5c4b fees: make flushes log debug only (ismaelsadeeq)

Pull request description:

  This is a simple PR that updates the flushing log to use debug-level logging under the estimatefee category. It also ensures the log consistently includes only the full file path.
  The motivation behind this is that the "Flushed fee estimates to fee_estimates.dat." logs can become noisy; it's done after one hour, so hiding it in the debug estimatefee category seems reasonable.

  ---
  I left the logs when the file is not found as info because that should only occur when you start a fresh node, change datadir, or explicitly delete the file

ACKs for top commit:
  achow101:
    ACK 02b5f6078d65c3a2f9ba8b30474d8201516c5c4b
  furszy:
    utACK 02b5f6078d65c3a2f9ba8b30474d8201516c5c4b
  l0rinc:
    Lightly tested ACK 02b5f6078d65c3a2f9ba8b30474d8201516c5c4b
  sipa:
    utACK 02b5f6078d65c3a2f9ba8b30474d8201516c5c4b

Tree-SHA512: 3e4b822caa23db9b30f1bb8990b36f35dcfcd82dbfb27c319463447da1df988eded84c47d5319ad637c822bdd04f0a727a176da3632c40d786332b6a5aaa6d89
2026-02-03 12:08:54 -08:00
MarcoFalke
fad9dd1a88
test: kernel test fixups
* Allow byte arrays; Adjust size check, which would otherwise fail,
  because two byte arrays of a type are always of the same size:
  https://github.com/bitcoin/bitcoin/pull/30595#discussion_r2642930435

* Require empty range:
  https://github.com/bitcoin/bitcoin/pull/30595#discussion_r2653846374
2026-02-03 20:27:19 +01:00
MarcoFalke
fabb58d42d
test: Use clang-tidy named args for create_chainman
https://github.com/bitcoin/bitcoin/pull/30595#discussion_r2653846863
2026-02-03 20:09:27 +01:00
MarcoFalke
fa51594c5c
refactor: Small style fixups in src/kernel/bitcoinkernel.cpp
* Use type alias TranslateFn:
  https://github.com/bitcoin/bitcoin/pull/30595#discussion_r2653828562
* Use std::span::data:
  https://github.com/bitcoin/bitcoin/pull/30595#discussion_r2653829743
* Use the ref helper:
  https://github.com/bitcoin/bitcoin/pull/30595#discussion_r2653829991
* Reword error handling section:
  https://github.com/bitcoin/bitcoin/pull/30595#discussion_r2653843805
2026-02-03 20:07:17 +01:00
Fabian Jahr
e53934422a
doc: Expand documentation on asmap feature and tooling 2026-02-03 18:05:32 +01:00
Fabian Jahr
6244212a55
init, net: Implement usage of binary-embedded asmap data 2026-02-03 18:05:30 +01:00
Fabian Jahr
6202b50fb9
build: Generate ip_asn.dat.h during build process
This can be disabled with -DWITH_EMBEDDED_ASMAP=OFF.
2026-02-03 18:03:37 +01:00
Fabian Jahr
634cd60dc8
build: Add embedded asmap data
The data embedded is from the latest ASMap file from the asmap-data
repository: https://github.com/asmap/asmap-data/blob/main/1755187200_asmap.dat
2026-02-03 18:03:36 +01:00
ismaelsadeeq
02b5f6078d
fees: make flushes log debug only
- Also log the full file path of fee_estimates.dat consistently.
2026-02-03 13:53:41 +00:00
merge-script
b58eebf152
Merge bitcoin/bitcoin#34470: Bump leveldb subtree and remove UB workaround in CI
fad7d86d8d17d89238ed9a2b2305cb3ed6a32cf4 ci: Remove unused workaround after leveldb subtree bump (MarcoFalke)
2f2952c5f2e367ccac34025a159c9fbaffd7f172 Squashed 'src/leveldb/' changes from cad64b151d..ab6c84e6f3 (MarcoFalke)

Pull request description:

  Bump leveldb subtree and remove UB workaround in CI. This also fixes a GCC-16 warning.

ACKs for top commit:
  l0rinc:
    code review ACK fad7d86d8d17d89238ed9a2b2305cb3ed6a32cf4
  fanquake:
    ACK fad7d86d8d17d89238ed9a2b2305cb3ed6a32cf4

Tree-SHA512: dccd53ca638f1acbd72187032d858453e1cc58b156a52e24356c075ac85be0db47d7b73965131b5fbc7b188cbc34cbfd72a8286e860c3b28258daaf5437546f2
2026-02-03 11:26:40 +00:00
merge-script
8bb277c123
Merge bitcoin/bitcoin#34481: Update secp256k1 subtree to latest master
d405713197f857d3a630ab52117e08ee7ae00789 ci: use Alpine 3.23 (fanquake)
1cee0e4cd3afd7043b517227828d44a4316f2872 ci: detect apk usage generally (fanquake)
9d4c9b00356e02de223033adb7680b47b743caab Squashed 'src/secp256k1/' changes from 14e56970cb..57315a6985 (fanquake)

Pull request description:

  Updates the secp256k1 subtree to latest master (57315a6985), which includes https://github.com/bitcoin-core/secp256k1/pull/1813.

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

Tree-SHA512: 6f01f85c309d7b823f41f215a9c856871dcd3d4113ac38cf2cf8e2f2c8a4c9d5f3c9f0e12b95cd9140045c66523eeb49aa536c0e91f9d17d5bf81fc95a2ad689
2026-02-03 11:11:18 +00:00
MarcoFalke
fabced56f6
Bump leveldb subtree
Command that was run:

git subtree pull --prefix src/leveldb https://github.com/bitcoin-core/leveldb-subtree bitcoin-fork --squash
2026-02-03 11:19:01 +01:00
Ava Chow
47c9297172
Merge bitcoin/bitcoin#32420: mining, ipc: omit dummy extraNonce from coinbase
d511adb664edcfb97be44bc0738f49b679240504 [miner] omit dummy extraNonce via IPC (Sjors Provoost)
bf3b5d6d069a0bbb39af0c487fd597257f862f31 test: clarify getCoinbaseRawTx() comparison (Sjors Provoost)
78df9003d63414e4a17b686af7647aeefd706ec5 [doc] Update comments on dummy extraNonces in tests (Anthony Towns)

Pull request description:

  This PR changes the Mining IPC interface to stop including a dummy `extraNonce` in the coinbase `scriptSig` by default, exposing only the consensus-required BIP34 height. This simplifies downstream mining software (including Stratum v2), avoids forcing clients to strip or ignore data we generate, and reduces the risk of incompatibilities if future soft forks add required commitments to the `scriptSig`.

  Existing behavior is preserved for RPCs, tests, regtest, and internal mining by explicitly opting in to the dummy `extraNonce` where needed (e.g. to satisfy `bad-cb-length` at low heights), so consensus rules and test coverage are unchanged. The remainder of the PR consists of small comment fixes, naming clarifications, and test cleanups to make the intent and behavior clearer.

ACKs for top commit:
  achow101:
    ACK d511adb664edcfb97be44bc0738f49b679240504
  ryanofsky:
    Code review ACK d511adb664edcfb97be44bc0738f49b679240504. Just rebased since last review and make suggested tweaks. I'd really like to see this PR merged for the cleanups and sanity it brings to this code. Needs another reviewer though.
  sedited:
    ACK d511adb664edcfb97be44bc0738f49b679240504

Tree-SHA512: d41fa813eb6b5626f4f475d8abc506b29090f4a2d218f2d6824db58b5ebe2ed7c584a903b44de18ccec142bb79c257b0aba6d6da073f56175aec88df96aaaaba
2026-02-02 15:21:16 -08:00
Ava Chow
ec0f47b15c miniscript: Using Func and Expr when parsing keys, hashes, and locktimes
Since pk(), pk_k(), pkh(), pk_h(), sha256(), ripemd160(), hash256(),
hash160(), after(), and older() all are single argument expressions that
are parsed immediately, we can use the Expr and Func parsing functions
to determine what the arguments of these expressions are, rather than
searching for the next closing parentheses.

This fixes an issue when pk(), pk_k(), pkh(), and pk_h() include a
musig() expression as Expr properly handles nested expressions.
2026-02-02 15:20:51 -08:00
Ava Chow
6fd780d4fb descriptors: Increment key_exp_index in ParsePubkey(Inner)
Simplifies the callsites for incrementing key_exp_index
2026-02-02 15:20:51 -08:00
Ava Chow
b12281bd86 miniscript: Use a reference to key_exp_index in KeyParser
For key_exp_index to count correctly for miniscript expressions,
KeyParser should hold a reference to it.
2026-02-02 15:20:51 -08:00
Ava Chow
ce4c66eb7c test: Test that key expression indexes match key count 2026-02-02 15:20:47 -08:00
Lőrinc
8c03318387
consensus/doc: explain GetValueOut() precondition
`Consensus::CheckTxInputs` calls `tx.GetValueOut()` and assumes output-range checks already ran.
Document the mempool and block validation call paths where this is guaranteed.

Co-authored-by: Antoine Poinsot <darosior@protonmail.com>
2026-02-02 19:32:14 +01:00
Lőrinc
82ef92c8d0
consensus/doc: explain unreachable bad-txns-fee-outofrange check
After the previous conditions were validated, document why `bad-txns-fee-outofrange` is unreachable once `nValueIn` and `value_out` are `MoneyRange` and `nValueIn >= value_out`.

Although unreachable, keep the check itself in place (instead of removing) as it's part of consensus-critical code; the comment serves as a proof for future refactors.

Inspired by b-c-cov coverage reports:
* "bad-txns-fee-outofrange" - https://maflcko.github.io/b-c-cov/test_bitcoin.coverage/src/consensus/tx_verify.cpp.gcov.html#L200
2026-02-02 19:32:13 +01:00
MarcoFalke
fad3eb3956
refactor: Use SpanReader over DataStream
The mutable temporary strValue can be re-used to apply the obfuscation,
which allows to avoid a redundant copy of the value.
2026-02-02 18:42:44 +01:00
MarcoFalke
fa06e26764
refactor: [qt] Use SpanReader to avoid two vector copies 2026-02-02 18:41:38 +01:00
MarcoFalke
fabd4d2e2e
refactor: Avoid UB in SpanReader::ignore
Currently std::span::subspan is called without checking the size first.

This is UB, unless the std lib is hardened.

With a hardened stdlib, the program aborts:

> include/c++/v1/span:512: libc++ Hardening assertion __offset <= size()
> failed: span<T>::subspan(offset, count): offset out of range

Fix the UB and the abort by using the implementation from DataStream,
which throws when hitting end-of-data.

This commit should not change any behavior, because the UB is currently
unreachable. Also, the newly added throw should properly be caught by
any code that calls any streams function.
2026-02-02 18:41:03 +01:00
stickies-v
37cc2a2d95 logging: use util/log.h where possible
Preparation for a future commit where kernel's dependency
on logging.cpp is removed completely.

Replace usage of logging\.h with util/log\.h where it
suffices, and fix wrong includes according to iwyu.
2026-02-02 17:22:31 +00:00
merge-script
8799eb7440
Merge bitcoin/bitcoin#33878: refactor, docs: Embedded ASMap [2/3]: Refactor asmap internals and add documentation
4fec726c4d352daf2fb4a7e5ed463e44c8815ddb refactor: Simplify Interpret asmap function (Fabian Jahr)
79e97d45c16f043d23ba318a661cc39ec53cf760 doc: Add more extensive docs to asmap implementation (Fabian Jahr)
cf4943fdcdd167a56c278ba094cecb0fa241a8f8 refactor: Use span instead of vector for data in util/asmap (Fabian Jahr)
385c34a05261846dac2b42d47f69b317f534dd40 refactor: Unify asmap version calculation and naming (Fabian Jahr)
fa41fc6a1a7d492b894e206f83e0c9786b44a2f0 refactor: Operate on bytes instead of bits in Asmap code (Fabian Jahr)

Pull request description:

  This is a second slice carved out of #28792. It contains the following changes that are crucial for the embedding of asmap data which is added the following PR in the series (probably this will remain in #28792).

  The changes are:
  - Modernizes and simplifies the asmap code by operating on `std::byte` instead of bits
  - Unifies asmap version calculation and naming (previously it was called version and checksum interchangeably)
  - Operate on a `span` rather than a vector in the asmap internal to prevent holding the asmap data in memory twice
  - Add more extensive documentation to the asmap implementation
  - Unify asmap casing in implemetation function names

  The first three commits were already part of #28792, the others are new.

  The documentation commit came out of feedback gathered at the latest CoreDev. The primary input for the documentation was the documentation that already existed in the Python implementation (`contrib/asmap/asmap.py`) but there are several other comments as well. Please note: I have also asked several LLMs to provide suggestions on how to explain pieces of the implementation and better demonstrate how the parts work together. I have copied bits and pieces that I liked but everything has been edited further by me and obviously all mistakes here are my own.

ACKs for top commit:
  hodlinator:
    re-ACK 4fec726c4d352daf2fb4a7e5ed463e44c8815ddb
  sipa:
    ACK 4fec726c4d352daf2fb4a7e5ed463e44c8815ddb
  sedited:
    Re-ACK 4fec726c4d352daf2fb4a7e5ed463e44c8815ddb

Tree-SHA512: 950a591c3fcc9ddb28fcfdc3164ad3fbd325fa5004533c4a8b670fbf8b956060a0daeedd1fc2fced1f761ac49cd992b79cabe12ef46bc60b2559a7a613d0e166
2026-02-02 18:22:31 +01:00
stickies-v
bb8e9e7c4c logging: Move message formatting to util/log.h
With this change, callers can use util/log.h to emit log messages and do not need to
include the full logging implementation in logging.h.

There's a potential performance impact with this change from an extra
`strprintf` call in log statements where `Logger::WillLogCategoryLevel` returns
true but `Logger::Enabled` returns false. This happens when bitcoind is run
with `-noprinttoconsole -nodebuglogfile` options.

For background, log macro arguments are supposed to be evaluated when
`Logger::WillLogCategoryLevel` returns true, even if log output is not enabled.
Changing this behavior would be reasonable but needs consideration in a
separate PR since not evaluating arguments in log statements has the potential
to change non-logging behavior.

The extra `strprintf` call could have been avoided by expanding this change and
making the `ShouldLog()` function return a tri-state DO_LOG / DO_NOT_LOG /
DO_NOT_LOG_ONLY_EVALUATE_ARGS value instead of a bool, but this complexity did
not seem warranted.

Review with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2026-02-02 17:22:31 +00:00
stickies-v
001f0a428e move-only: Move logging macros to util/log.h
Move logging macros to util/log.h so the entire codebase can use the same
macros.

Review with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2026-02-02 17:22:31 +00:00
stickies-v
94c0adf4e8 move-onlyish: Move logging levels to util/log.h
This is not strictly move-only because BCLog::Level is now defined as a type
alias for util::log::Level;

Review with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2026-02-02 17:22:31 +00:00
stickies-v
56d113cab0 move-only: move logging categories to logging/categories.h
Logging categories are currently shared between node and kernel. This
separation allows future commits to completely remove kernel's
dependency on logging.h.

Also applies clang-format suggestions to the moved code.

Review with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2026-02-02 17:22:31 +00:00
stickies-v
f5233f7e98 move-only: Move SourceLocation to util/log.h
Introduce util/log.h as a lightweight header for code that only needs to emit
log messages. Move SourceLocation into this header so log-emitting code no
longer needs to include logging.h and depend on the full log management API.

This is a move-only change and the first change of several changes that
separate log generation from log handling. It also applies clang-format
suggestions to the moved code.

Review with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2026-02-02 17:22:31 +00:00
MarcoFalke
fa20bc2ec2
refactor: Use empty() over eof() in the streams interface
End-of-file does not really make sense for streams that wrap buffers. So
replace it by the equivalent empty() checks.
2026-02-02 17:55:10 +01:00
fanquake
1ed3de5a6d
Update secp256k1 subtree to latest master 2026-02-02 15:21:14 +00:00
fanquake
9d4c9b0035 Squashed 'src/secp256k1/' changes from 14e56970cb..57315a6985
57315a6985 Merge bitcoin-core/secp256k1#1813: Remove trailing spaces and introduce `-Wtrailing-whitespace=any` compiler flag
86cae58d2f build: Add `-Wleading-whitespace=spaces` compiler flag
fb229e7602 build: Add `-Wtrailing-whitespace=any` compiler flag
13e3bee504 refactor: Remove trailing whitespace
453949ab2a Merge bitcoin-core/secp256k1#1816: ci: Rotate Docker cache keys
cd49c57e44 Merge bitcoin-core/secp256k1#1814: release process: mention the `[Unreleased]` link clearly
2ccff6eb73 ci: Add weekly schedule
2f18567d24 ci: Rotate Docker cache keys every 4 weeks
0ffb1749a5 ci, docker: Fix LLVM repository signature failure
0267b65512 release process: mention the `[Unreleased]` link clearly
1605b02f75 Merge bitcoin-core/secp256k1#1775: Add CMake build directory patterns to `.gitignore`
748c0fdd67 Add CMake build directory patterns to `.gitignore`
7eb86bdb01 autotools: Rename `build-aux` to `autotools-aux`

git-subtree-dir: src/secp256k1
git-subtree-split: 57315a69853c9bd4765fccf20b541d47f1b45ca9
2026-02-02 15:21:14 +00:00
merge-script
41034a032f
Merge bitcoin/bitcoin#34396: fuzz: pull the latest FuzzedDataProvider.h from upstream
dfb93646093f8d71be455fc95e2e06ff73fb9211 fuzz: pull latest FuzzedDataProvider.h from upstream (b-l-u-e)

Pull request description:

  Pulls down the latest version of https://github.com/llvm/llvm-project/blob/main/compiler-rt/include/fuzzer/FuzzedDataProvider.h, after https://github.com/llvm/llvm-project/pull/177794 was merged upstream.

ACKs for top commit:
  fanquake:
    ACK dfb93646093f8d71be455fc95e2e06ff73fb9211 - updated the PR description.

Tree-SHA512: 36d003a1d92158537811d044bf4b79d63f0ec79e5b0da9e26a73a869c81578f9597ababcb79bb1949689db506c25341255c59979214ee28343fa08f85e2c3466
2026-02-02 09:55:46 +00:00
merge-script
ff09583928
Merge bitcoin/bitcoin#34432: test: Turn ElapseSteady into SteadyClockContext
facb2aab26dffbc1e46809ac776ed43b9eaa9ad4 test: Turn ElapseSteady into SteadyClockContext (MarcoFalke)

Pull request description:

  `ElapseSteady` was introduced a while back, but is only used in one place. It makes more sense if this were a context manager, so that mocktime does not leak from one test into the next.

  So turn it into a context manager, rename it and allow easy time advancement via e.g. `steady_ctx += 1h`.

ACKs for top commit:
  l0rinc:
    ACK facb2aab26dffbc1e46809ac776ed43b9eaa9ad4
  ismaelsadeeq:
    utACK facb2aab26dffbc1e46809ac776ed43b9eaa9ad4
  sedited:
    ACK facb2aab26dffbc1e46809ac776ed43b9eaa9ad4

Tree-SHA512: 1df9cc9685d9be4d3ab8deafd99ac1a5ff752064ae54b83bacd6f44ba2c198b091558a306d49d8b1e2200ac669e95915cc792d589fb3a63b2bef7891d325a1e0
2026-02-02 10:44:55 +01:00
merge-script
81e67d9aa1
Merge bitcoin/bitcoin#34179: refactor: Enable transparent lookup for setBlockIndexCandidates to remove const_cast
3bd98b45084d3029465110a99e2486d48944ded8 refactor: use transparent comparator for setBlockIndexCandidates lookups (joaonevess)

Pull request description:

  ### Rationale

  This PR improves code safety by removing a `const_cast` in `src/validation.cpp`.

  Currently, `setBlockIndexCandidates` stores mutable `CBlockIndex*`. However, validation logic (like `CVerifyDB`) often holds `const CBlockIndex*`. Previously, checking for existence in the set required casting away constness. While currently benign, this bypasses compiler safety checks and could mask accidental modifications in future refactors.

  ### Description

  1.  **Enable Heterogeneous Lookup:** Added `using is_transparent = void;` to `CBlockIndexWorkComparator` in `src/node/blockstorage.h`. This allows the `std::set` to natively accept `const CBlockIndex*` for lookup (utilizing C++14 heterogeneous lookup).
  2.  **Remove Cast:** Removed the now unnecessary `const_cast<CBlockIndex*>` in `src/validation.cpp`, allowing the compiler to strictly enforce const-correctness.

  ### Notes

  - **Refactoring only:** No behavioral change.
  - **Verification:** `validation_tests` and `blockmanager_tests` pass.

ACKs for top commit:
  maflcko:
    review ACK 3bd98b45084d3029465110a99e2486d48944ded8 🚪
  frankomosh:
    ACK 3bd98b45084d3029465110a99e2486d48944ded8. Good use of transparent comparator to eliminate `const_cast` in this specific code path.
  sedited:
    ACK 3bd98b45084d3029465110a99e2486d48944ded8

Tree-SHA512: 0f76bdce2a54b759dfec99633afce1e95586e62f4057ecf1e82eed1a073eb8ecb2d659ccbf28a7a139f0aa09a30f058ac6966cafdfbf1f2ee878fa2d86b2c487
2026-02-02 08:49:02 +01:00
merge-script
ec70bead5e
Merge bitcoin/bitcoin#34433: script: remove unused SCRIPT_ERR_LAST
51abf7d15b1da5b74d58a381ced662dc0f70b4b0 script: remove unused SCRIPT_ERR_LAST (Antoine Poinsot)

Pull request description:

  It was introduced in ab9edbd6b6eb3efbca11f16fa467c3c0ef905708 and never used since. It seems it might have been intended to be exposed as part of a public library interface, which has since been superseded.

  The only call site uses SCRIPT_ERR_ERROR_COUNT directly.

ACKs for top commit:
  billymcbip:
    tACK 51abf7d15b1da5b74d58a381ced662dc0f70b4b0
  sedited:
    ACK 51abf7d15b1da5b74d58a381ced662dc0f70b4b0
  theStack:
    ACK 51abf7d15b1da5b74d58a381ced662dc0f70b4b0

Tree-SHA512: 983b0523b2b5eba57732223af22746c9f29e4759d23366147825d1101f94a9b10c385f305d1425c439a4e29ab28f5a9245691ba6dc31a13f260d3d03b0bf1885
2026-02-02 08:16:43 +01:00