47715 Commits

Author SHA1 Message Date
Fabian Jahr
fa41fc6a1a refactor: Operate on bytes instead of bits in Asmap code
Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com>
2026-01-20 23:45:28 +01:00
Hodlinator
964c44cdcd test(miniscript): Prove avoidance of stack overflow
Can be tested through emptying the function body of ~Node() or replacing Clone() implementation with naive version:
```C++
Node<Key> Clone() const
{
    std::vector<Node> new_subs;
    new_subs.reserve(subs.size());
    for (const Node& child : subs) {
        new_subs.push_back(child.Clone());
    }
    return Node{internal::NoDupCheck{}, m_script_ctx, fragment, std::move(new_subs), keys, data, k};
}
```

Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
2026-01-20 22:41:25 +01:00
Hodlinator
198bbaee49 refactor(miniscript): Destroy nodes one full subs-vector at a time 2026-01-20 22:41:25 +01:00
Hodlinator
50cab8570e refactor(miniscript): Remove NodeRef & MakeNodeRef()
(Also removes parameter to TestSatisfy() which existed unused from the start in 22c5b00345).
2026-01-20 22:41:25 +01:00
Hodlinator
15fb34de41 refactor(miniscript): Remove superfluous unique_ptr-indirection
Functional parity is achieved through making Node move-able.

Unfortunately ~Node() now needs to have the recursion linter disabled, as it is unable to figure out that recursion stops 1 level down. The former smart pointers must have been circumventing the linter somehow.

NodeRef & MakeNodeRef() are deleted in the following commit (broken out to facilitate review).
2026-01-20 22:41:25 +01:00
Hodlinator
e55b23c170 refactor(miniscript): Remove Node::subs mutability 2026-01-20 22:35:03 +01:00
Hodlinator
c6f798b222 refactor(miniscript): Make fields non-const & private
Makes a lot of fields in miniscript.h non-const in order to allow move-operations 2 commits later.

Also fixes adjacent comment typos.

Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2026-01-20 22:35:03 +01:00
Hodlinator
22e4115312 doc(miniscript): Remove mention of shared pointers
Correct destructor implementation comment to no longer refer to shared pointers and also move it into the function body, in symmetry with Clone() right below.

Leftover from #30866.
2026-01-20 22:35:03 +01:00
Ava Chow
f7e88e298a Merge bitcoin/bitcoin#32471: wallet/rpc: fix listdescriptors RPC fails to return descriptors with private key information when wallet contains descriptors missing any key
9c7e4771b1 test: Test listdescs with priv works even with missing priv keys (Novo)
ed945a6854 walletrpc: reject listdes with priv key on w-only wallets (Novo)
9e5e9824f1 descriptor: ToPrivateString() pass if  at least 1 priv key exists (Novo)
5c4db25b61 descriptor: refactor ToPrivateString for providers (Novo)
2dc74e3f4e wallet/migration: use HavePrivateKeys in place of ToPrivateString (Novo)
e842eb90bb descriptors: add HavePrivateKeys() (Novo)

Pull request description:

  _TLDR:
  Currently, `listdescriptors [private=true]` will fail for a non-watch-only wallet if any descriptor has a missing private key(e.g `tr()`, `multi()`, etc.). This PR changes that while making sure `listdescriptors [private=true]` still fails if there no private keys. Closes #32078_

  In non-watch-only wallets, it's possible to import descriptors as long as at least one private key is included. It's important that users can still view these descriptors when they need to create a backup—even if some private keys are missing ([#32078 (comment)](https://github.com/bitcoin/bitcoin/issues/32078#issuecomment-2781428475)). This change makes it possible to do so.

  This change also helps prevent `listdescriptors true` from failing completely, because one descriptor is missing some private keys.

  ### Notes
  - The new behaviour is applied to all descriptors including miniscript descriptors
  - `listdescriptors true` still fails for watch-only wallets to preserve existing behaviour https://github.com/bitcoin/bitcoin/pull/24361#discussion_r920801352
  - Wallet migration logic previously used `Descriptor::ToPrivateString()` to determine which descriptor was watchonly. This means that modifying the `ToPrivateString()` behaviour caused descriptors that were previously recognized as "watchonly" to be "non-watchonly". **In order to keep the scope of this PR limited to the RPC behaviour, this PR uses a different method to determine `watchonly` descriptors for the purpose of wallet migration.** A follow-up PR can be opened to update migration logic to exclude descriptors with some private keys from the `watchonly` migration wallet.

  ### Relevant PRs
  https://github.com/bitcoin/bitcoin/pull/24361
  https://github.com/bitcoin/bitcoin/pull/32186

  ### Testing
  Functional tests were added to test the new behaviour

  EDIT
  **`listdescriptors [private=true]` will still fail when there are no private keys because non-watchonly wallets must have private keys and calling `listdescriptors [private=true]` for watchonly wallet returns an error**

ACKs for top commit:
  Sjors:
    ACK 9c7e4771b1
  achow101:
    ACK 9c7e4771b1
  w0xlt:
    reACK 9c7e4771b1 with minor nits
  rkrux:
    re-ACK 9c7e4771b1

Tree-SHA512: f9b3b2c3e5425a26e158882e39e82e15b7cb13ffbfb6a5fa2868c79526e9b178fcc3cd88d3e2e286f64819d041f687353780bbcf5a355c63a136fb8179698b60
2026-01-20 12:17:19 -08:00
woltx
34bed0ed8c test: use IP_PORTRANGE_HIGH on FreeBSD for dynamic port allocation
On FreeBSD, the default ephemeral port range (10000-65535) overlaps
with the test framework's static port range (11000-26000), causing
intermittent "address already in use" failures when tests use dynamic
port allocation (port=0).

Add a helper function that sets the IP_PORTRANGE/IPV6_PORTRANGE socket
option to IP_PORTRANGE_HIGH before binding, which requests ports from
the high range (49152-65535) instead. This range does not overlap with
the test framework's static ports.

Constants from FreeBSD's netinet/in.h and netinet6/in6.h:
- IP_PORTRANGE = 19 (for IPv4 sockets)
- IPV6_PORTRANGE = 14 (for IPv6 sockets)
- IP_PORTRANGE_HIGH = 1

Fixes: bitcoin/bitcoin#34331

Co-Authored-By: Vasil Dimov <vd@FreeBSD.org>
Co-Authored-By: MarcoFalke <*~=\`'#}+{/-|&$^_@721217.xyz>
2026-01-20 12:08:05 -08:00
rustaceanrob
ccf9172ab3 util: Remove FilterHeaderHasher
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
2026-01-20 16:26:50 +00:00
merge-script
7f5ebef56a Merge bitcoin/bitcoin#34302: fuzz: Restore SendMessages coverage in process_message(s) fuzz targets
fabf8d1c5b fuzz: Restore SendMessages coverage in process_message(s) fuzz targets (MarcoFalke)
fac7fed397 refactor: Use std::reference_wrapper<AddrMan> in Connman (MarcoFalke)

Pull request description:

  *Found and reported by Crypt-iQ (thanks!)*

  Currently the process_message(s) fuzz targets do not have any meaningful `SendMessages` code coverage. This is not ideal.

  Fix the problem by adding back the coverage, and by hardening the code here, so that the problem hopefully does not happen again in the future.

  ### Historic context for this regression

  The regression was introduced in commit fa11eea405, which built a new deterministic peerman object. However, the patch was incomplete, because it was missing one hunk to replace `g_setup->m_node.peerman->SendMessages(&p2p_node);` with `peerman->SendMessages(&p2p_node);`.

  This means the stale and empty peerman from the node context and not the freshly created and deterministic peerman was used.

  A simple fix would be to just submit the missing patch hunk. However, this still leaves the risk that the issue is re-introduced at any time in the future. So instead, I think the stale and empty peerman should be de-constructed, so that any call to it will lead to a hard sanitizer error and fuzz failure.

  Doing that also uncovered another issue: The connman was holding on to a reference to a stale and empty addrman.

  So fix all issues by:

  * Allowing the addrman reference in connman to be re-seatable
  * Clearing all stale objects, before creating new objects, and then using references to the new objects in all code

ACKs for top commit:
  Crypt-iQ:
    crACK fabf8d1c5b
  frankomosh:
    ACK fabf8d1c5b
  marcofleon:
    code review ACK fabf8d1c5b
  sedited:
    ACK fabf8d1c5b

Tree-SHA512: 2e478102b3e928dc7505f00c08d4b9e4f8368407b100bc88f3eb3b82aa6fea5a45bae736c211f5af1551ca0de1a5ffd4a5d196d9473d4c3b87cfed57c9a0b69d
2026-01-20 16:45:18 +01:00
merge-script
a6e8cd306e Merge bitcoin/bitcoin#34310: iwyu: Add missed line to IWYU patch
de509c6df9 iwyu: Add missed line to IWYU patch (Hennadii Stepanov)

Pull request description:

  This PR makes IWYU suggest `<cassert>` over `<assert.h>`.

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

ACKs for top commit:
  maflcko:
    lgtm ACK de509c6df9

Tree-SHA512: edba91eaf36992f684be2920f5da8c13a25ba6d79b879b92193e2af106cd454a64d7c4cf9dabc25675490df9edbccff1fd54c9f393e984a3a7a628b1c65f6c53
2026-01-20 14:57:09 +00:00
merge-script
f4413706f9 Merge bitcoin/bitcoin#34344: ci: update GitHub Actions versions
9482f00df0 chore: Update outdated GitHub Actions versions (Padraic Slattery)

Pull request description:

  This PR updates outdated GitHub Action versions to ensure compatibility and improve functionality. The following changes are made to the GitHub Actions:
  - `actions/upload-artifact` updated from v4 to v6
  - `actions/cache` updated from v4 to v5
  - `actions/download-artifact` updated from v5 to v7

  The updates are necessary to support newer environments and features, and ensure consistent behavior across different workflows. The changes will be tested in the CI pipeline of the pull request.

ACKs for top commit:
  fanquake:
    ACK 9482f00df0

Tree-SHA512: 248e79162c5b2748e1a367d87a360d62eb961c24b4f8060bb932ef99a79ef10cab3e65175c092226c90140f31686fb9424911e6609729cb186b304b598a9af44
2026-01-20 14:49:38 +00:00
Hennadii Stepanov
fdc9fe2da6 ci, iwyu: Fix warnings in src/primitives and treat them as errors 2026-01-20 14:46:00 +00:00
Lőrinc
477c5504e0 coins: replace std::distance with unambiguous pointer subtraction
Avoid calling `std::distance` on null pointers in `PoolResource::AllocateChunk`.
 Compute remaining bytes with `m_available_memory_end - m_available_memory_it` instead, which is well-defined to be `0` when both are `nullptr`.

Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2026-01-20 15:35:19 +01:00
MarcoFalke
faa18dceba refactor: Use std::bind_front over std::bind 2026-01-20 15:30:46 +01:00
merge-script
c84c752506 Merge bitcoin/bitcoin#34319: Drop some IWYU pragma: export and document IWYU usage
d938947b3a doc: Add "Using IWYU" to Developer Notes (Hennadii Stepanov)
e1a90bcecc iwyu: Do not export `crypto/hex_base.h` header (Hennadii Stepanov)
19a2edde50 iwyu: Do not export C++ headers in most cases (Hennadii Stepanov)

Pull request description:

  First two commits address comments from discussion in https://github.com/bitcoin/bitcoin/pull/33779:
  - https://github.com/bitcoin/bitcoin/pull/33779#discussion_r2697579248
  - https://github.com/bitcoin/bitcoin/pull/33779#discussion_r2697707343

  The last commit adds a new section to the Developer Notes to document IWYU usage.

ACKs for top commit:
  maflcko:
    re-ACK d938947b3a 🚀

Tree-SHA512: 8d6c63e9d2fd190815211d80e654cb7379d16b6611b8851444f49bbbaa0fbc93557675fbcc558afd9a1cdf643570fba5eff9c1aecb5530f978797387b10b9a11
2026-01-20 10:29:09 +00:00
merge-script
38f951f828 Merge bitcoin/bitcoin#34308: doc: Document IWYU workaround
03f363d378 doc: Document IWYU workaround (Hennadii Stepanov)

Pull request description:

  This PR addresses the following comments:
  - https://github.com/bitcoin/bitcoin/pull/34079#discussion_r2640003086:
    > it would be good to reduce and report this bug upstream. Otherwise, wide-spread use of iwyu in this code-base seems risky.

  - https://github.com/bitcoin/bitcoin/pull/34079#discussion_r2640035350:
    > Would have been good if it was documented, rather than adding undocumented workarounds for buggy tools.

ACKs for top commit:
  maflcko:
    lgtm ACK 03f363d378
  sedited:
    ACK 03f363d378

Tree-SHA512: 160a963c07f853995c8b4741a6ccca1d8431a576c760fca082116cebde4d133f7c8ec51f09e8f85f54428f86bad2635e1bd708177eecf71feb0bf1489f1e2b3e
2026-01-20 09:51:42 +00:00
merge-script
ab80588f52 Merge bitcoin/bitcoin#34345: clang-format: use AngleBracket for main includes
0dafc0d83c clang-format: use AngleBracket for main includes (stickies-v)

Pull request description:

  This project uses angle brackets instead of quotes for project-specific headers. Setting [`MainIncludeChar`](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#mainincludechar) enables `clang-format` to automatically detect the main header, so it can be kept as the top group of includes.

  For example, without this change, `clang-format` would demote `<signet.h>` from being the main header in `src/signet.cpp`. With this change, the order is preserved.

  On 5e49f5d63c:
  ```
  % clang-format src/signet.cpp | head -n 15
  // Copyright (c) 2019-present The Bitcoin Core developers
  // Distributed under the MIT software license, see the accompanying
  // file COPYING or http://www.opensource.org/licenses/mit-license.php.

  #include <consensus/merkle.h>
  #include <consensus/params.h>
  #include <consensus/validation.h>
  #include <logging.h>
  #include <primitives/block.h>
  #include <primitives/transaction.h>
  #include <script/interpreter.h>
  #include <script/script.h>
  #include <signet.h>
  #include <streams.h>
  #include <uint256.h>

  ```

  With this PR:
  ```
  % clang-format src/signet.cpp | head -n 10
  // Copyright (c) 2019-present The Bitcoin Core developers
  // Distributed under the MIT software license, see the accompanying
  // file COPYING or http://www.opensource.org/licenses/mit-license.php.

  #include <signet.h>

  #include <consensus/merkle.h>
  #include <consensus/params.h>
  #include <consensus/validation.h>
  #include <logging.h>

  ```

  Note: `AngleBracket` `requires clang-format 19`, and will cause older versions (including our current minimum llvm version `17`) to fail

ACKs for top commit:
  maflcko:
    review ACK 0dafc0d83c
  sedited:
    Nice, ACK 0dafc0d83c
  hebasto:
    ACK 0dafc0d83c, tested on Ubuntu 25.10.

Tree-SHA512: c0876f505ec188f76e435af0731c411c66266b83e4c08528d0637263abcd84b3968ee6fbfa72630192f1a0cd2728af873d3d6c32f93ab8b228222fad16f232be
2026-01-20 09:39:24 +00:00
naiyoma
81675a781f test: use pre-generated chain 2026-01-20 12:08:51 +03:00
Ava Chow
977be171f2 Merge bitcoin/bitcoin#34188: test: Add multiple transactions and error handling tests for getreceivedbyaddress
d45ec3fba9 test: Add getreceivedbyaddress coverage to wallet_listreceivedby (b-l-u-e)

Pull request description:

  This PR adds comprehensive functional test coverage for the `getreceivedbyaddress` RPC method.

ACKs for top commit:
  maflcko:
    lgtm ACK d45ec3fba9
  fjahr:
    reACK d45ec3fba9
  achow101:
    ACK d45ec3fba9
  rkrux:
    lgtm ACK d45ec3fba9

Tree-SHA512: e7f024297c18b2e11da108d9588bbf96089dce24e2fdee255dbd2f754f21ec63cb3cefa6d92b621b5ab66d18fe29523b87d14ceba38a83afa4c85eb5944a0fb3
2026-01-19 17:04:00 -08:00
Ava Chow
347840164f Merge bitcoin/bitcoin#32143: Fix 11-year-old mis-categorized error code in OP_IF evaluation
a7b581423e Fix 11-year-old mis-categorized error code in OP_IF evaluation (Calin Culianu)

Pull request description:

  This was introduced by commit ab9edbd6b6.

  It appears the original author may have gotten tired and pasted the wrong error code into this 1 place. Every other situation where the value stack lacks the required number of arguments for the op-code, SCRIPT_ERR_INVALID_STACK_OPERATION is reported. Not so here.

  This commit fixes the situation.

  EDIT: Note this turns out to be a dupe of the abandoned #30359 .

ACKs for top commit:
  billymcbip:
    tACK a7b581423e
  achow101:
    ACK a7b581423e
  darosior:
    utACK a7b581423e
  sedited:
    ACK a7b581423e

Tree-SHA512: e8c01a3e2448b5d49b76a0cab3f38a2d0249b71beeb7d9d05d5ecc3812bd91d0bd1d0f78b809b6f4ccb73186fa119cb1ed3779a73284b83a67ae219ef378fa6c
2026-01-19 16:39:45 -08:00
Lőrinc
969c840db5 log,blocks: avoid ComputeTotalSize and GetHash work when logging is disabled
`PartiallyDownloadedBlock::FillBlock()` computed the block header hash and summed missing transaction sizes for debug logging unconditionally, including when cmpctblock debug logging is disabled.

Guard the debug-only hash and size computations with `LogAcceptCategory`.
Since `txn_available` is invalidated after the first loop (needed for efficient moving), we compute `tx_missing_size` by iterating `vtx_missing` directly. This is safe because the later `tx_missing_offset` check guarantees `vtx_missing` was fully consumed during reconstruction.

Use `block.GetHash()` instead of `header.GetHash()`, since header is cleared before logging.

No behavior change when debug logging is enabled: the reported counts, hashes, and byte totals remain the same.
2026-01-19 20:20:13 +01:00
Lőrinc
babfda332b log,net: avoid ComputeTotalSize when logging is disabled
`PeerManagerImpl::SendBlockTransactions()` computed the total byte size of requested transactions for a debug log line by calling `ComputeTotalSize()` in a tight loop, triggering serialization even when debug logging is off.

Guard the size accumulation with `LogAcceptCategory` so the serialization work only happens when the log line can be emitted.

No behavior change when debug logging is enabled: the reported block hash, transaction count, and byte totals are the same.
The bounds checks still run unconditionally; the debug-only loop iterates the already-validated response contents.

Separating debug-only work from the critical path reduces risk and favors the performance-critical non-debug case.
This also narrows the racy scope of when logging is toggled from another thread.
2026-01-19 20:20:13 +01:00
Lőrinc
1658b8f82b refactor: rename CTransaction::GetTotalSize to signal that it's not cached
Transaction hashes are cached, it may not be intuitive that their sizes are actually recalculated every time.
This is done before the other refactors to clarify why we want to avoid calling this method;

Co-authored-by: maflcko <6399679+maflcko@users.noreply.github.com>
2026-01-19 20:20:13 +01:00
Ava Chow
75b704df9d wallettool: Disallow creating new unnamed wallets 2026-01-19 10:57:13 -08:00
Ava Chow
5875a9c502 wallet: disallow unnamed wallets in createwallet and restorewallet
Migration still needs to be able to restore unnamed wallets, so
allow_unnamed is added to RestoreWallet to explicitly allow that
behavior for migration only.
2026-01-19 10:55:55 -08:00
stickies-v
0dafc0d83c clang-format: use AngleBracket for main includes
This project uses angle brackets instead of quotes for project-specific
headers. Setting MainIncludeChar enables clang-format to automatically
detect the main header, so it can be kept as the top group of includes.

For example, without this change, the below command would demote
<signet.h> from being the main header. With this change, the order is
preserved.

`clang-format -i src/signet.cpp`
2026-01-19 17:11:23 +00:00
Hennadii Stepanov
03f363d378 doc: Document IWYU workaround 2026-01-19 17:05:59 +00:00
Hennadii Stepanov
d938947b3a doc: Add "Using IWYU" to Developer Notes 2026-01-19 17:03:16 +00:00
Hennadii Stepanov
e1a90bcecc iwyu: Do not export crypto/hex_base.h header 2026-01-19 17:03:11 +00:00
Hennadii Stepanov
19a2edde50 iwyu: Do not export C++ headers in most cases
`IWYU pragma: export` enforces the transitive inclusion of the headers,
which undermines the purpose of IWYU.

The remained cases seem useful and could be considered separately:
- `<cassert>` in `util/check.h`
- `<filesystem>` in `util/fs.h`
- `<chrono>` in `util/time.h`
2026-01-19 17:03:03 +00:00
Padraic Slattery
9482f00df0 chore: Update outdated GitHub Actions versions 2026-01-19 17:45:37 +01:00
merge-script
898e8d3a2d Merge bitcoin/bitcoin#34296: refactor: [move-only] Merge core_io module, remove from libkernel
faf07bd1ab doc: Fix typo found by LLM (MarcoFalke)
faf66673ac refactor: [move-only] Merge core_io module (MarcoFalke)
fa6947f491 kernel: Remove unused core_read.cpp from kernel (MarcoFalke)

Pull request description:

  Currently the core_io module is split across two translation units. This will confuse code readers and tooling about the real state of the module.

  Fix that by merging the module and removing the mapping workarounds.

  Also, remove the module from the kernel lib, because it is not used there: The kernel does not use any json or string parsing or formatting.

ACKs for top commit:
  hebasto:
    re-ACK faf07bd1ab, only rebased since my recent [review](https://github.com/bitcoin/bitcoin/pull/34296#pullrequestreview-3675359502).
  sedited:
    Re-ACK faf07bd1ab
  stickies-v:
    ACK faf07bd1ab

Tree-SHA512: 3f5d91f1a4cb86dfe329b28ff31e93d65f2f0659a6f6f2de22ca6fb65056fb818ae369ef0ad773d4f5b92f63891a7a9450246377d8e14c34bc43f3deee0554cb
2026-01-19 17:45:05 +01:00
Lőrinc
14f99cfe53 rpc: make uptime monotonic across NTP jumps
Compute `uptime` from `SteadyClock` so it is unaffected by system time changes after startup.

Derive GUI startup time by subtracting the monotonic uptime from the wall clock time.

Add a functional test covering a large `setmocktime` jump.

Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2026-01-19 17:08:08 +01:00
MarcoFalke
faf07bd1ab doc: Fix typo found by LLM 2026-01-19 12:57:19 +01:00
MarcoFalke
faf66673ac refactor: [move-only] Merge core_io module
This can be reviewed with the git option
--color-moved=dimmed-zebra
2026-01-19 12:57:16 +01:00
MarcoFalke
fa6947f491 kernel: Remove unused core_read.cpp from kernel
Also, util/string and util/strencodings
2026-01-19 12:56:59 +01:00
merge-script
5e49f5d63c Merge bitcoin/bitcoin#33779: ci, iwyu: Fix warnings in src/kernel and treat them as errors
a5a8c4139c ci, iwyu: Fix warnings in `src/kernel` and treat them as errors (Hennadii Stepanov)

Pull request description:

  Now seems like a good time to update the includes in `src/kernel`.

ACKs for top commit:
  maflcko:
    review ACK a5a8c4139c 🍱
  purpleKarrot:
    ACK a5a8c4139c
  sedited:
    ACK a5a8c4139c

Tree-SHA512: ba401b27b03dee66d52d0b348972268e162506c4bafa40f408349173b68c40a11f20ca24f46c98945515e1d5c84f740d6e6784f7e4c799df46ab816cf5d11483
2026-01-19 12:46:29 +01:00
Lőrinc
a9440b1595 util: add TicksSeconds
Add a helper to convert durations to integer seconds.
2026-01-19 12:37:01 +01:00
merge-script
c57fbbe99d Merge bitcoin/bitcoin#31650: refactor: Avoid copies by using const references or by move-construction
fa64d8424b refactor: Enforce readability-avoid-const-params-in-decls (MarcoFalke)
faf0c2d942 refactor: Avoid copies by using const references or by move-construction (MarcoFalke)

Pull request description:

  Top level `const` in declarations is problematic for many reasons:

  * It is often a typo, where one wanted to denote a const reference. For example `bool PSBTInputSignedAndVerified(const PartiallySignedTransaction psbt, ...` is missing the `&`. This will create a redundant copy of the value.
  * In constructors it prevents move construction.
  * It can incorrectly imply some data is const, like in an imaginary example `std::span<int> Shuffle(const std::span<int>);`, where the `int`s are *not* const.
  * The compiler ignores the `const` from the declaration in the implementation.
  * It isn't used consistently anyway, not even on the same line.

  Fix some issues by:

  * Using a const reference to avoid a copy, where read-only of the value is intended. This is only done for values that may be expensive to copy.
  * Using move-construction to avoid a copy
  * Applying `readability-avoid-const-params-in-decls` via clang-tidy

ACKs for top commit:
  l0rinc:
    diff reACK fa64d8424b
  hebasto:
    ACK fa64d8424b, I have reviewed the code and it looks OK.
  sedited:
    ACK fa64d8424b

Tree-SHA512: 293c000b4ebf8fdcc75259eb0283a2e4e7892c73facfb5c3182464d6cb6a868b7f4a6682d664426bf2edecd665cf839d790bef0bae43a8c3bf1ddfdd3d068d38
2026-01-19 11:44:04 +01:00
b-l-u-e
d45ec3fba9 test: Add getreceivedbyaddress coverage to wallet_listreceivedby
- Add test for multiple transactions to same address
- Add test for invalid address format error
2026-01-18 22:57:44 +03:00
Hennadii Stepanov
22bde74d1d Merge bitcoin-core/gui#924: Show an error message if the restored wallet name is empty
dd904298c1 gui: Show an error message if the restored wallet name is empty (Ava Chow)

Pull request description:

  The Restore Wallet dialog rejects wallet names that are empty, but was doing so silently. This is confusing, we should be presenting an error message to the user.

ACKs for top commit:
  hebasto:
    ACK dd904298c1. Tested on Fedora 43.

Tree-SHA512: f4b60f32d1c2550dbce8613f25d29a92588b1ecfc8e8e5dac691a6bdb21a77508288a904539b68333d96bde5ebb993912253f4a293e4c583891f553d95762e77
2026-01-17 10:04:56 +00:00
David Gumberg
a02c4a82d8 refactor: Move -walletbroadcast setting init
Modifying `fBroadcastTransactions` does not require any locks,
initialization of this wallet parameter can be relocated with all of the
other argument parsing in this function.
2026-01-16 11:29:11 -08:00
David Gumberg
411caf7281 wallet: refactor: PopulateWalletFromDB use switch statement.
Co-authored-by: @w0xlt <w0xlt@users.noreply.github.com>
2026-01-16 11:29:11 -08:00
David Gumberg
a48e23f566 refactor: wallet: move error handling to PopulateWalletFromDB() 2026-01-16 11:29:11 -08:00
Hennadii Stepanov
81bf4209e9 Merge bitcoin/bitcoin#34318: contrib: Revert "verify-commits sha1 exceptions"
fa38ffac6f contrib: [refactor] Use shorter read_text from pathlib (MarcoFalke)
fab8bc0308 contrib: Revert "verify-commits sha1 exceptions" (MarcoFalke)

Pull request description:

  This reverts commit 8ac134be5e, because it is no longer needed.

  See https://github.com/bitcoin/bitcoin/pull/34245#issuecomment-3759448369

  Also, use the shorter pathlib `read_text`, which is available since Python 3.5

ACKs for top commit:
  dergoegge:
    utACK fa38ffac6f
  sedited:
    ACK fa38ffac6f
  hebasto:
    ACK fa38ffac6f.

Tree-SHA512: 83049349d4a5c74ad700c2912d727584b88944a75d572c10661a76b69b08093ef7ebf786b359455e36d7467a708de46a77da41a54512e057d7eed8206984c8fd
2026-01-16 18:01:52 +00:00
Hennadii Stepanov
a5a8c4139c ci, iwyu: Fix warnings in src/kernel and treat them as errors 2026-01-16 14:25:45 +00:00
MarcoFalke
fa38ffac6f contrib: [refactor] Use shorter read_text from pathlib 2026-01-16 14:40:06 +01:00