7853 Commits

Author SHA1 Message Date
merge-script
6d625af283 Merge bitcoin/bitcoin#32621: contrib: utxo_to_sqlite.py: add option to store txid/spk as BLOBs
7378f27b4f test: run utxo-to-sqlite script test with spk/txid format option combinations (Sebastian Falbesoner)
b30fca7498 contrib: utxo_to_sqlite.py: add options to store txid/spk as BLOBs (Sebastian Falbesoner)

Pull request description:

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

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

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

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

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

Pull request description:

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

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

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

Tree-SHA512: 96409ed55f686961c47949d31569d6be8e424d952883c92a9135a4e8a795047d4e2a86c9d27ef5653d21780717275434b0bca1586059cfd5088cd2c867c7baea
2026-02-07 15:08:08 +01:00
merge-script
54bd49c7e3 Merge bitcoin/bitcoin#34452: test: split interface_ipc.py
633d183119 test: misc interface_ipc_mining.py improvements (Sjors Provoost)
52ccd9215e test: split interface_ipc_mining.py into subtests (Sjors Provoost)
4e49fa2a68 test: add interface_ipc_mining.py (Sjors Provoost)
01a1ae889e test: move IPC helpers to ipc_util.py (Sjors Provoost)

Pull request description:

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

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

  Review hint:

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

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

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

Pull request description:

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

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

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

Pull request description:

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

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

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

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

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

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

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

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

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

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

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

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

Register the new test in test_runner.py.

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

Rename some helpers for clarity:
- parse_and_deserialize_block -> mining_get_block
- parse_and_deserialize_coinbase_tx -> mining_get_coinbase_tx
- get_coinbase_raw_tx -> mining_get_coinbase_raw_tx
- wait_next_template -> mining_wait_next_template
2026-02-06 15:44:06 +01:00
stratospher
48161f6a05 wallet: introduce "tx amount exceeds balance when fees are included" error
This was previously implemented at the GUI level but we never hit that
code path.

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
2026-02-06 16:27:22 +05:30
Ava Chow
9ec1ae0e98 Merge bitcoin/bitcoin#34437: rpc: uptime should begin on application start
e67a676df9 fix: uptime RPC returns 0 on first call (Lőrinc)

Pull request description:

  ### Problem
  #34328 switched uptime to use monotonic time, but `g_startup_time` was a function-local static in `GetUptime()`, meaning it was initialized on first call rather than at program start.
  This caused the first uptime RPC to always return 0.

  ### Fix
  Move `g_startup_time` to namespace scope so it initializes at program start, ensuring the first `uptime()` call returns actual elapsed time.

  ### Reproducer

  Revert the fix and run the test or alternatively:

  ```bash
  cmake -B build && cmake --build build --target bitcoind bitcoin-cli -j$(nproc)
  ./build/bin/bitcoind -regtest -daemon
  sleep 10
  ./build/bin/bitcoin-cli -regtest uptime
  ./build/bin/bitcoin-cli -regtest stop
  ```

  <details>
  <summary>Before (uptime is initialized on first call)</summary>

  ```bash
  Bitcoin Core starting
  0
  Bitcoin Core stopping
  ```

  </details>

  <details>
  <summary>After (first uptime call is in-line with sleep)</summary>

  ```bash
  Bitcoin Core starting
  10
  Bitcoin Core stopping
  ```
  </details>

  ----

  Fixes #34423, added reporter as coauthor.

ACKs for top commit:
  maflcko:
    lgtm ACK e67a676df9
  optout21:
    crACK e67a676df9
  carloantinarella:
    Tested ACK e67a676df9
  achow101:
    ACK e67a676df9
  musaHaruna:
    Tested ACK [e67a676](e67a676df9)

Tree-SHA512: b156f7ed15c3fbb50e8a15f6c9a0d4e2ffb956d0c6ef949e0f8a661a564a20c0d3ed2149fae75ce7e2baa9326788d5037e726e7a7ac2c6ef4e70e4862cd5763f
2026-02-05 17:02:37 -08:00
Ava Chow
4ae00e9a71 Merge bitcoin/bitcoin#32636: Split CWallet::Create() into CreateNew and LoadExisting
db2effaca4 scripted-diff: refactor: CWallet::Create() -> CreateNew() (David Gumberg)
27e021ebc0 wallet: Correctly log stats for encrypted messages. (David Gumberg)
d8bec61be2 wallet: remove loading logic from CWallet::Create (David Gumberg)
f35acc893f refactor: wallet: Factor out `WriteVersion()` from `PopulateWalletFromDB()` (David Gumberg)
e12ff8aca0 test: wallet: Split create and load (David Gumberg)
70dbc79b09 wallet: Use CWallet::LoadExisting() for loading existing wallets. (David Gumberg)
ae66e01164 wallet: Create separate function for wallet load (David Gumberg)
bc69070416 refactor: Wallet stats logging in its own function (David Gumberg)
a9d64cd49c wallet: Remove redundant birth time update (David Gumberg)
b4a49cc727 wallet: Move argument parsing to before DB load (David Gumberg)
b15a94a618 refactor: Split out wallet argument loading (David Gumberg)
a02c4a82d8 refactor: Move -walletbroadcast setting init (David Gumberg)
411caf7281 wallet: refactor: PopulateWalletFromDB use switch statement. (David Gumberg)
a48e23f566 refactor: wallet: move error handling to PopulateWalletFromDB() (David Gumberg)
0972785fd7 wallet: Delete unnecessary PopulateWalletFromDB() calls (David Gumberg)
f0a046094e 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 db2effaca4
  polespinasa:
    approach ACK db2effaca4
  w0xlt:
    reACK db2effaca4
  murchandamus:
    ACK db2effaca4
  rkrux:
    ACK db2effaca4

Tree-SHA512: c28d60e0a3001058da3fd2bdbe0726c7ebe742a4b900a1dee2e5132eccc22e49619cb747a99b4032b000eafd4aa2fdd4ec244c32be2012aba809fdc94b5f6ecd
2026-02-04 11:06:36 -08:00
Ava Chow
3532e24213 Merge bitcoin/bitcoin#32748: fees: fix noisy flushing log
02b5f6078d 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 02b5f6078d
  furszy:
    utACK 02b5f6078d
  l0rinc:
    Lightly tested ACK 02b5f6078d
  sipa:
    utACK 02b5f6078d

Tree-SHA512: 3e4b822caa23db9b30f1bb8990b36f35dcfcd82dbfb27c319463447da1df988eded84c47d5319ad637c822bdd04f0a727a176da3632c40d786332b6a5aaa6d89
2026-02-03 12:08:54 -08: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
Ava Chow
47c9297172 Merge bitcoin/bitcoin#32420: mining, ipc: omit dummy extraNonce from coinbase
d511adb664 [miner] omit dummy extraNonce via IPC (Sjors Provoost)
bf3b5d6d06 test: clarify getCoinbaseRawTx() comparison (Sjors Provoost)
78df9003d6 [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 d511adb664
  ryanofsky:
    Code review ACK d511adb664. 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 d511adb664

Tree-SHA512: d41fa813eb6b5626f4f475d8abc506b29090f4a2d218f2d6824db58b5ebe2ed7c584a903b44de18ccec142bb79c257b0aba6d6da073f56175aec88df96aaaaba
2026-02-02 15:21:16 -08:00
merge-script
8799eb7440 Merge bitcoin/bitcoin#33878: refactor, docs: Embedded ASMap [2/3]: Refactor asmap internals and add documentation
4fec726c4d refactor: Simplify Interpret asmap function (Fabian Jahr)
79e97d45c1 doc: Add more extensive docs to asmap implementation (Fabian Jahr)
cf4943fdcd refactor: Use span instead of vector for data in util/asmap (Fabian Jahr)
385c34a052 refactor: Unify asmap version calculation and naming (Fabian Jahr)
fa41fc6a1a 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 4fec726c4d
  sipa:
    ACK 4fec726c4d
  sedited:
    Re-ACK 4fec726c4d

Tree-SHA512: 950a591c3fcc9ddb28fcfdc3164ad3fbd325fa5004533c4a8b670fbf8b956060a0daeedd1fc2fced1f761ac49cd992b79cabe12ef46bc60b2559a7a613d0e166
2026-02-02 18:22:31 +01:00
MarcoFalke
fa879db735 test: Read debug log for self-checking comment
The DataStream comment was a bit stale, because it was using
CDataStream.

Fix it by using assert_debug_log for a self-documenting and
self-checking test code.
2026-02-02 16:38:12 +01:00
Ava Chow
88f8029835 Merge bitcoin/bitcoin#34100: doc: Use multipath descriptors in descriptors.md and linked test
552bc82b17 doc: Use multipath descriptors in descriptors.md and linked test (Anurag chavan)

Pull request description:

  Updates documentation and `wallet_miniscript_decaying_multisig_descriptor_psbt.py` to use single multipath descriptors with `<0;1>` syntax instead of separate external/internal descriptors.

  ## Changes
  - **doc/descriptors.md**: Update examples (lines 70-71) to use `/<0;1>/*` multipath syntax
  - **doc/descriptors.md**: Update Basic Multisig Example instructions (line 179) to use single multipath descriptor
  - **test/functional/wallet_miniscript_decaying_multisig_descriptor_psbt.py**: Refactor to use single multipath descriptor pattern matching `wallet_multisig_descriptor_psbt.py`

  ## Implementation
  - `_get_xpub()` now extracts external descriptor and converts to multipath format
  - `create_multisig()` imports single descriptor that expands to receive and change addresses
  - Removed fake checksums from documentation examples
  - Added clear comments documenting multipath convention

  Fixes #34086

ACKs for top commit:
  yashbhutwala:
    ACK 552bc82b17
  achow101:
    ACK 552bc82b17
  rkrux:
    lgtm tACK 552bc82

Tree-SHA512: cc99271a3955daa475242d9f4ef8f09f4c94c64e48ec4647ecfd95dceb38bb0cdd91b78ec2d5f033b449d175eaecbdda49d6c766c8a1e1a01fed93be4eb0cfc0
2026-01-30 17:29:47 -08:00
Ava Chow
5ad94cf6b7 Merge bitcoin/bitcoin#34381: script: return proper error for CScriptNum errors
6f7b4323cb test: remove UNKNOWN_ERROR from script_tests (Bruno Garcia)
bd31a92d67 script: use SCRIPT_ERR_SCRIPTNUM for CScriptNum errors (Bruno Garcia)
0ca4dcd786 script: add SCRIPT_ERR_SCRIPTNUM error (Bruno Garcia)

Pull request description:

  When evaluating a script, the current code is bad for analyzing some errors because it returns `SCRIPT_ERR_UNKNOWN_ERROR` for errors that are clearly known.

  `CScriptNum` has two well defined errors: number overflow and non-minimally encoded number. However, for both errors we return as unknown. This PR changes it by adding a new ScriptError that is used for any `CScriptNum` error.

ACKs for top commit:
  achow101:
    ACK 6f7b4323cb
  w0xlt:
    ACK 6f7b4323cb
  darosior:
    ACK 6f7b4323cb

Tree-SHA512: e656d9992251fbc95d33966fa18ce64bf714179d51ba6a7f429e5a55bc58e7fc08827e4ab71ace0dd385dac7e1feaea621b49503387793a30eae7a7e44aa6b0f
2026-01-30 16:22:43 -08:00
merge-script
0d1d393877 Merge bitcoin/bitcoin#34429: test: Check that redundant verack message is ignored
fafdae46ff test: Check that redundant verack message is ignored (MarcoFalke)

Pull request description:

  The code exists and is uncovered (ref https://maflcko.github.io/b-c-cov/total.coverage/src/net_processing.cpp.gcov.html#L3795), so add a trivial test to cover it.

ACKs for top commit:
  brunoerg:
    ACK fafdae46ff
  sedited:
    ACK fafdae46ff

Tree-SHA512: 157f434c2faa16243890b2344c4ee36bc359e56c80ba8a04f0bba71e9760cf9106c38ed755ff57eff8d1957f35516d20b3d010e0ecb8633b845f5314cc0d050a
2026-01-30 09:40:57 +01:00
Ava Chow
5401e673d5 Merge bitcoin/bitcoin#33604: p2p: Allow block downloads from peers without snapshot block after assumeutxo validation
7d9e1a8102 test: Verify peer usage after assumeutxo validation completes (stringintech)
0067abe153 p2p: Allow block downloads from peers without snapshot block after assumeutxo validation (stringintech)

Pull request description:

  Currently, after assumeutxo background validation finishes, the node continues to skip peers that don't have the snapshot block in their best chain until restart. This unnecessarily excludes peers from block downloads even though the background sync has completed and undo data is available.

  The restriction persists because `m_chainman.CurrentChainstate().SnapshotBase()` continues to return the snapshot base block until restart, even after validation completes. Added `m_chainman.CurrentChainstate().m_assumeutxo == Assumeutxo::UNVALIDATED` check to only apply the peer restriction while background validation is ongoing.

  Also added test coverage in `feature_assumeutxo.py` that verifies peers without the snapshot block can be used for block downloads after background validation completes. The test fails without this fix.

ACKs for top commit:
  fjahr:
    Re-ACK 7d9e1a8102
  achow101:
    ACK 7d9e1a8102
  sedited:
    Re-ACK 7d9e1a8102

Tree-SHA512: 5515971da7bf7efc55eecdf03686f44c20c9e52dd168e7cfa119032d6a8ebccee69df7143075e4e9d0a01426cd9ae7202dce5c00919a82478ebf49a15dc0fe19
2026-01-29 15:11:04 -08:00
Ava Chow
4e4fa0199e Merge bitcoin/bitcoin#33680: validation: do not wipe utxo cache for stats/scans/snapshots
c6ca2b85a3 validation: do not wipe utxo cache for stats/scans/snapshots (Pieter Wuille)
7099e93d0a refactor: rename `FlushStateMode::ALWAYS` to `FORCE_FLUSH` (Lőrinc)

Pull request description:

  Revival of https://github.com/bitcoin/bitcoin/pull/30610#issuecomment-3432564955 with the remaining comments applied on top

  > Since #28280, the cost of a non-wiping sync of the UTXO cache is only proportional to the number of dirty entries, rather than proportional to the size of the entire cache. Because of that, there is no reason to perform a wiping flush in case the contents of the cache is still useful.
  >
  > Split the `FlushStateMode::ALWAYS` mode into a FORCE_SYNC (non-wiping) and a FORCE_FLUSH (wiping), and then use the former in `scantxoutset`, `gettxoutsetinfo`, snapshot creation.

  (slightly updated after #30214)

ACKs for top commit:
  optout21:
    reACK c6ca2b85a3
  cedwies:
    reACK c6ca2b8 (trivial)
  achow101:
    ACK c6ca2b85a3
  sedited:
    ACK c6ca2b85a3

Tree-SHA512: f3525a85dc512db4a0a9c749ad47c0d3fa44085a121aa54cd77646260a719c71f754ec6570ae77779c0ed68a24799116f79c686e7a17ce57a26f6a598f7bf926
2026-01-29 14:43:27 -08:00
Lőrinc
e67a676df9 fix: uptime RPC returns 0 on first call
The monotonic uptime fix (#34328) used a function-local static for `g_startup_time`, which was initialized on first `GetUptime()` call instead of app startup time.
This caused the first `uptime()` call to always return 0.

Move `g_startup_time` to namespace scope so it initializes at program start, ensuring the first call returns actual elapsed time. Note that we don't need to make it `static` anymore because it is just used in this single translation unit.

Test was updated to simulate some work before the first call.

Co-authored-by: Carlo Antinarella <carloantinarella@users.noreply.github.com>
2026-01-29 19:53:48 +01:00
Hennadii Stepanov
f7e0c3d3d3 Merge bitcoin/bitcoin#34346: test: use IP_PORTRANGE_HIGH on FreeBSD for dynamic port allocation
2845f10a2b test: extend FreeBSD ephemeral port range fix to P2P listeners (node)
34bed0ed8c test: use IP_PORTRANGE_HIGH on FreeBSD for dynamic port allocation (woltx)

Pull request description:

  Reopening #34336. I’ve now tested it on FreeBSD and confirmed it works.

  On FreeBSD, the default ephemeral port range (10000-65535) overlaps with the test framework's static port range (11000-26000), possibly causing intermittent "address already in use" failures when tests use dynamic port allocation (`port=0`).

  This PR adds a helper that sets `IP_PORTRANGE_HIGH` via `setsockopt()` before binding, requesting ports from 49152-65535 instead, which avoids the overlap, as suggested in https://github.com/bitcoin/bitcoin/issues/34331#issuecomment-3767161843 by @maflcko .

  From FreeBSD's [sys/netinet/in.h](https://cgit.freebsd.org/src/tree/sys/netinet/in.h):
    ```c
    #define IP_PORTRANGE         19
    #define IP_PORTRANGE_HIGH    1
    #define IPPORT_EPHEMERALFIRST 10000  /* default range start */
    #define IPPORT_HIFIRSTAUTO   49152   /* high range start */
  ```

  See also: FreeBSD https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4 man page.

  Fixes #34331

ACKs for top commit:
  vasild:
    ACK 2845f10a2b
  hebasto:
    ACK 2845f10a2b, I have reviewed the code and it looks OK.

Tree-SHA512: ce501ce3e8a4023e07bad572df2b85d6829becf133813e4529aebba83e4eba59fa8b48e9d2197ebbb226adaf3054fad720775a787244d6b38c0078ee086102f4
2026-01-29 11:33:35 +00:00
Ava Chow
cd1af852fa Merge bitcoin/bitcoin#34358: wallet: fix removeprunedfunds bug with conflicting transactions
1f60ca360e wallet: fix removeprunedfunds bug with conflicting transactions (Martin Zumsande)

Pull request description:

  `removeprunedfunds` removes all entries from `mapTxSpends` for the inputs of the pruned tx. However, this is incorrect, because there could be multiple entries from conflicting transactions (that shouldn't be removed as well). This could lead to the wallet creating invalid transactions, trying to double spend utxos.
  The bug persists when the conflicting tx was mined, because the wallet trusts its internal accounting instead of calling `AddToSpends` again.

  The added test should fail on master.

ACKs for top commit:
  achow101:
    ACK 1f60ca360e
  fjahr:
    tACK 1f60ca360e
  furszy:
    utACK 1f60ca360e
  vasild:
    ACK 1f60ca360e

Tree-SHA512: 3cc9ed547530fd53e25721177b76ab2e1eae16ce2c0e63fc01b20fdbf8bd02655dae51167ad56f9dec748d34c61ce65d38f993370820601f8257c73b876a3347
2026-01-28 11:25:28 -08:00
merge-script
2dd5e7bb38 Merge bitcoin/bitcoin#34409: test: use ModuleNotFoundError in interface_ipc.py
905dfdee86 test: use ModuleNotFoundError in interface_ipc.py (fanquake)

Pull request description:

  Change this so we catch the case where the capnp shared libs have been updated, and can no-longer be loaded by the Python module, resulting in a skipped test, even though pycapnp is installed. i.e:
  ```bash
  stderr:
  Traceback (most recent call last):
    File "/root/ci_scratch/build/test/functional/interface_ipc.py", line 20, in <module>
      import capnp  # type: ignore[import] # noqa: F401
      ^^^^^^^^^^^^
    File "/usr/local/lib64/python3.14/site-packages/capnp/__init__.py", line 36, in <module>
      from .version import version as __version__
    File "/usr/local/lib64/python3.14/site-packages/capnp/version.py", line 1, in <module>
      from .lib.capnp import _CAPNP_VERSION_MAJOR as LIBCAPNP_VERSION_MAJOR  # noqa: F401
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ImportError: libcapnpc.so.1.0.1: cannot open shared object file: No such file or directory
  ```

  Failing in this way should make it clear that `pycapnp` needs to be reinstalled/rebuilt.

  If  `pycapnp` is not installed, the test still skips as expected:
  ```bash
  Remaining jobs: [interface_ipc.py]
  1/1 - interface_ipc.py skipped (capnp module not available.)

  TEST             | STATUS    | DURATION

  interface_ipc.py | ○ Skipped | 0 s
  ```

  Fixes: #34016.

ACKs for top commit:
  maflcko:
    lgtm ACK 905dfdee86
  hebasto:
    ACK 905dfdee86, I have reviewed the code and it looks OK. However, I'm [not able](https://github.com/bitcoin/bitcoin/issues/34016#issuecomment-3799532047) to reproduce https://github.com/bitcoin/bitcoin/issues/34016.
  sedited:
    ACK 905dfdee86

Tree-SHA512: 3cedbe8fc51cc18f1c993f7747d20905f3bf94c736db99a9c4090f5823bf8c09dfbc19ef03c573d504dcdfba6ea0f7d088a7f4563b220742c9a441167c04cfd6
2026-01-28 19:06:20 +01:00
merge-script
a7460b9928 Merge bitcoin/bitcoin#34098: test: [move-only] Move lint functions into modules
fa578d9434 lint: [move-only] Move python related lints to lint_py.rs (MarcoFalke)
fa392c31e7 lint: [move-only] Move repo related lints to lint_repo_hygiene.rs (MarcoFalke)
fab0cfa987 lint: [move-only] Move cpp related lints to lint_cpp.rs (MarcoFalke)
fa3e48e3fd lint: [move-only] Move docs related lints to lint_docs.rs (MarcoFalke)
fad09e77db lint: [move-only] Move text related lints to text_format.rs (MarcoFalke)
faf40c2f84 lint: [move-only] Move util functions to util.rs (MarcoFalke)

Pull request description:

  The single, large `main.rs` file is fine, but at some point it becomes harder to read.

  So reduce the size by pulling functions out into modules.

  This can be reviewed with the git option: `--color-moved=dimmed-zebra`

ACKs for top commit:
  l0rinc:
    Lightly tested code review ACK fa578d9434
  sedited:
    ACK fa578d9434

Tree-SHA512: f1e29fd3cf695fb6634d0b9f9e55508992b4b9885afee9dbe4d5d9e99cad3061e7141f39acbfe69d698422888169128cd7658a6dc991fd904b8520328b51586d
2026-01-28 17:20:21 +01:00
merge-script
6ae96ed607 Merge bitcoin/bitcoin#34276: Remove empty caption from user interface (noui, gui)
fad7bd9ba3 noui: Remove always empty caption while formatting (MarcoFalke)
fa8ebeb332 refactor: [gui] Document that the title is always empty for node message (MarcoFalke)
fafe71b743 refactor: Remove empty caption from ThreadSafeMessageBox (MarcoFalke)
fa8d0088e7 refactor: Remove empty caption from ThreadSafeQuestion (MarcoFalke)
fa0195499c refactor: [gui] Use lambdas over std::bind (MarcoFalke)
eeee1e341f refactor: Remove trailing semicolon after ADD_SIGNALS_DECL_WRAPPER (MarcoFalke)

Pull request description:

  Currently, the user interface (noui, gui) has a caption for each message. However, the caption has many issues:

  * It is always hard-coded to the empty string.
  * This is confusing and tedious when reading or maintaining the code.
  * It is redundant, because `noui` will ignore the caption and set the logging prefix (error, warning, info) based on the `style`.
  * The gui does prefer to set the title based on the caption, but since it the caption is always empty, the fallback will always be used.

  Fix all issues by removing it.

ACKs for top commit:
  hebasto:
    ACK fad7bd9ba3, I have reviewed the code and it looks OK. Tested on Ubuntu 25.10.
  sedited:
    ACK fad7bd9ba3

Tree-SHA512: 58ef538b9b3e1cfdcf2955f6de9b8cee335edbf6339723cb693cb4d584817904c962dac5199ee44d7e2860a5332dec1a6abf47e621eb5cf919aa1cdae271b55f
2026-01-28 13:43:56 +01:00
MarcoFalke
fafdae46ff test: Check that redundant verack message is ignored 2026-01-28 13:05:42 +01:00
merge-script
1d3243806d Merge bitcoin/bitcoin#34391: lint: upgrade lint scripts for worktrees
5aeaa71c77 lint: pass args from lint.py to cargo run in container (will)
c17a2adb8d lint: upgrade lint scripts for worktrees (will)

Pull request description:

  Fixes #29972

  Use a single script to run the linter locally or in CI.

  Works from inside a worktree.

ACKs for top commit:
  maflcko:
    review ACK 5aeaa71c77 🔒
  davidgumberg:
    code review and lightly tested reACK 5aeaa71
  l0rinc:
    Tested (+ lightly reviewed) ACK 5aeaa71c77

Tree-SHA512: 7c11f649b4752739d31c4f9e6306a98bd2e615b27a0819bbb5e7d9284b9e28bd9f424e145f16361f672f1a63441a1ae2f901c4f99759e997b72a4bf2d56d8d39
2026-01-28 09:51:15 +00:00
Sjors Provoost
d511adb664 [miner] omit dummy extraNonce via IPC
Previously the coinbase transaction generated by our miner code was
not used downstream, because the getblocktemplate RPC excludes it.

Since the Mining IPC interface was introduced in #30200 we do expose
this dummy coinbase transaction. In Stratum v2 several parts of it
are communicated downstream, including the scriptSig.

This commit removes the dummy extraNonce from the coinbase scriptSig
in block templates requested via IPC. This limits the scriptSig
to what is essential for consensus (BIP34) and removes the need for
external mining software to remove the dummy, or even ignore
the scriptSig we provide and generate it some other way. This
could cause problems if a future soft fork requires additional
data to be committed here.

A test is added to verify the new IPC behavior.

It achieves this by introducing an include_dummy_extranonce
option which defaults to false with all test code updated to
set it to true. Because this option is not exposed via IPC,
callers will no longer see it.

The caller needs to ensure that for blocks 1 through 16
they pad the scriptSig in order to avoid bad-cb-length.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
2026-01-27 14:45:35 +01:00
Sjors Provoost
bf3b5d6d06 test: clarify getCoinbaseRawTx() comparison
The code comment mistakingly referred to "the deprecated getCoinbaseTx()",
instead of getCoinbaseRawTx. This was missed in d59b4cdb57.

Also rename parse_and_deserialize_coinbase_tx to make it more clear
it refers to the deprecated method.

Finally, this commit drops the getCoinbaseRawTx() call when testing
template inspectors. The coinbase input check here is already covered by
build_coinbase_test.
2026-01-27 14:45:04 +01:00
Anthony Towns
78df9003d6 [doc] Update comments on dummy extraNonces in tests 2026-01-27 14:41:00 +01:00
merge-script
27aeeff630 Merge bitcoin/bitcoin#34328: rpc: make uptime monotonic across NTP jumps
14f99cfe53 rpc: make `uptime` monotonic across NTP jumps (Lőrinc)
a9440b1595 util: add `TicksSeconds` (Lőrinc)

Pull request description:

  ### Problem
  `bitcoin-cli uptime` was derived from wall-clock time, so it could jump by large amounts when the system clock is corrected after `bitcoind` starts (e.g. on RTC-less systems syncing NTP).
  This breaks the expectation that uptime reflects process runtime.

  ### Fix
  Compute uptime from a [monotonic clock](https://en.cppreference.com/w/cpp/chrono/steady_clock.html) so it is immune to wall-clock jumps, and use that monotonic uptime for the RPC.
  GUI startup time is derived from wall clock time minus monotonic uptime so it remains sensible after clock corrections.

  ### Reproducer
  Revert the fix commit and run the `rpc_uptime` functional test (it should fail with `AssertionError: uptime should not jump with wall clock`):

  Or alternatively:

  ```bash
  cmake -B build && cmake --build build --target bitcoind bitcoin-cli -j$(nproc)
  DATA_DIR=$(mktemp -d)
  ./build/bin/bitcoind -regtest -datadir="$DATA_DIR" -connect=0 -daemon
  ./build/bin/bitcoin-cli -regtest -datadir="$DATA_DIR" -rpcwait uptime
  sleep 1
  ./build/bin/bitcoin-cli -regtest -datadir="$DATA_DIR" setmocktime $(( $(date +%s) + 20000000 ))
  ./build/bin/bitcoin-cli -regtest -datadir="$DATA_DIR" uptime
  ./build/bin/bitcoin-cli -regtest -datadir="$DATA_DIR" stop
  ```

  <details>
  <summary>Before (uptime jumps with wall clock)</summary>

  ```bash
  Bitcoin Core starting
  0
  20000001
  Bitcoin Core stopping
  ```

  </details>

  <details>
  <summary>After (uptime stays monotonic)</summary>

  ```bash
  Bitcoin Core starting
  0
  1
  Bitcoin Core stopping
  ```
  </details>

  ----------

  Issue: https://github.com/bitcoin/bitcoin/issues/34326

ACKs for top commit:
  maflcko:
    review ACK 14f99cfe53 🎦
  willcl-ark:
    tACK 14f99cfe53
  w0xlt:
    ACK 14f99cfe53
  sedited:
    ACK 14f99cfe53

Tree-SHA512: 3909973f58666ffa0b784a6df087031b9e34d2022d354900a4dbb6cbe1d36285cd92770ee71350ebf64d6e8ab212d8ff0cd851f7dca1ec46ee2f19b417f53984
2026-01-27 13:26:43 +01:00
will
5aeaa71c77 lint: pass args from lint.py to cargo run in container 2026-01-27 12:20:04 +00:00
will
c17a2adb8d lint: upgrade lint scripts for worktrees
Add a ci/lint.py script to run the linter both locally or inside the CI
(replacing .github/ci-lint-exec.py) which supports running from a
worktree.

Determines whether we are in a worktree, and mounts the real `.git`
directory as a read-only volume if we are.
2026-01-27 12:18:29 +00:00
merge-script
8593d96519 Merge bitcoin/bitcoin#33067: test: refactor ValidWitnessMalleatedTx class to helper function
3f5211cba8 test: remove child_one/child_two (w)txid variables (naiyoma)
7cfe790820 test: replace ValidWitnessMalleatedTx class with function (naiyoma)
81675a781f test: use pre-generated chain (naiyoma)

Pull request description:

  This PR refactors ` ValidWitnessMalleatedTx` class into a `build_malleated_tx_package` function. As a result, two tests are updated:  `mempool_accept_wtxid` and `p2p_p2p_private_broadcast`. Also included are a  few small refactors in mempool_accept_wtxid , (switching to MiniWallet, using a pre-mined chain, using txid directly.)

  Together, these changes reduce complexity and improve test runtime.

ACKs for top commit:
  stratospher:
    reACK 3f5211c.
  cedwies:
    reACK 3f5211c
  maflcko:
    review ACK 3f5211cba8 👥
  rkrux:
    ACK 3f5211cba8

Tree-SHA512: 1fd02be3432fef6b68e54fbe8b15ed56d2699580bb13d0777b21f9cbe4c6d33bbb710541e3ca2fc93eab771d17bf1c427e4b08fa216d561bdb320cc6b36ac8fc
2026-01-27 10:10:41 +00:00
fanquake
905dfdee86 test: use ModuleNotFoundError in interface_ipc.py
Change this so we catch the case where the capnp shared libs have been
updated, and can no-longer be loaded by the Python module, resulting in
a skipped test, even though pycapnp is installed. i.e:
```bash
stderr:
Traceback (most recent call last):
  File "/root/ci_scratch/build/test/functional/interface_ipc.py", line 20, in <module>
    import capnp  # type: ignore[import] # noqa: F401
    ^^^^^^^^^^^^
  File "/usr/local/lib64/python3.14/site-packages/capnp/__init__.py", line 36, in <module>
    from .version import version as __version__
  File "/usr/local/lib64/python3.14/site-packages/capnp/version.py", line 1, in <module>
    from .lib.capnp import _CAPNP_VERSION_MAJOR as LIBCAPNP_VERSION_MAJOR  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: libcapnpc.so.1.0.1: cannot open shared object file: No such file or directory
```

Failing in this way should make it clear that `pycapnp` needs to be
reinstalled/rebuilt.

If  `pycapnp` is not installed, the test still skips as expected:
```bash
Remaining jobs: [interface_ipc.py]
1/1 - interface_ipc.py skipped (capnp module not available.)

TEST             | STATUS    | DURATION

interface_ipc.py | ○ Skipped | 0 s
```

Fixes: #34016.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2026-01-26 11:55:23 +00:00
Martin Zumsande
1f60ca360e wallet: fix removeprunedfunds bug with conflicting transactions
removeprunedfunds removes all entries from mapTxSpends for the
inputs of the pruned tx. However, this is incorrect, because there could be
multiple entries from conflicting transactions (that shouldn't be
removed as well). This could lead to the wallet creating invalid
transactions, trying to double spend utxos.
The bug persists when the conflicting tx was mined, because
the wallet trusts its internal accounting instead of calling
AddToSpends again.
2026-01-26 09:06:52 +07:00
stringintech
7d9e1a8102 test: Verify peer usage after assumeutxo validation completes
Add test coverage to ensure peers without the snapshot block in their chain can be used for block downloads after background validation completes. The test fails without the fix in the previous commit.
2026-01-24 22:51:24 +03:30
fanquake
be2b48b9f3 test: allow overriding tar in get_previous_releases
Facilitate use on distros that might have 'tar' as something else, such
as 'gtar', i.e Chimera.
2026-01-23 13:05:45 +00:00
David Gumberg
d8bec61be2 wallet: remove loading logic from CWallet::Create 2026-01-22 13:24:06 -08:00
Bruno Garcia
bd31a92d67 script: use SCRIPT_ERR_SCRIPTNUM for CScriptNum errors 2026-01-22 12:13:01 -03:00
Fabian Jahr
e1dc4afeeb test: Rename wallet name in restore attempt in wallet_assumeutxo
This prevents potential intermittend failures on windows when the wallet by the same name from the previous test case hasn't been cleaned up yet by it's process.
2026-01-22 00:24:43 +01:00
merge-script
5715748333 Merge bitcoin/bitcoin#34366: test: switch order of error code and message check
0aba464ce7 test: switch order of error code and message check (rkrux)

Pull request description:

  I feel it'd be easier to debug intermittent test failures if the error message is present in the logs instead of error code. So, switching order of error code and message in the `try_rpc` function to aid error debugging.

  Should help in debugging #34354 IMO. It's an intermittent failure on Windows that I can't reproduce and it's more difficult to figure out what could have gone wrong only by seeing the error code like below in the CI logs. Given that the functional tests pass, I don't see a harm in checking for error message first and throwing it in case of a mismatch.

  ```python
  AssertionError: Unexpected JSONRPC error code -1
  ```

  <!--
  *** Please remove the following help text before submitting: ***

  Pull requests without a rationale and clear improvement may be closed
  immediately.

  GUI-related pull requests should be opened against
  https://github.com/bitcoin-core/gui
  first. See CONTRIBUTING.md
  -->

  <!--
  Please provide clear motivation for your patch and explain how it improves
  Bitcoin Core user experience or Bitcoin Core developer experience
  significantly:

  * Any test improvements or new tests that improve coverage are always welcome.
  * All other changes should have accompanying unit tests (see `src/test/`) or
    functional tests (see `test/`). Contributors should note which tests cover
    modified code. If no tests exist for a region of modified code, new tests
    should accompany the change.
  * Bug fixes are most welcome when they come with steps to reproduce or an
    explanation of the potential issue as well as reasoning for the way the bug
    was fixed.
  * Features are welcome, but might be rejected due to design or scope issues.
    If a feature is based on a lot of dependencies, contributors should first
    consider building the system outside of Bitcoin Core, if possible.
  * Refactoring changes are only accepted if they are required for a feature or
    bug fix or otherwise improve developer experience significantly. For example,
    most "code style" refactoring changes require a thorough explanation why they
    are useful, what downsides they have and why they *significantly* improve
    developer experience or avoid serious programming bugs. Note that code style
    is often a subjective matter. Unless they are explicitly mentioned to be
    preferred in the [developer notes](/doc/developer-notes.md), stylistic code
    changes are usually rejected.
  -->

  <!--
  Bitcoin Core has a thorough review process and even the most trivial change
  needs to pass a lot of eyes and requires non-zero or even substantial time
  effort to review. There is a huge lack of active reviewers on the project, so
  patches often sit for a long time.
  -->

ACKs for top commit:
  maflcko:
    lgtm ACK 0aba464ce7
  polespinasa:
    lgtm ACK 0aba464ce7
  fjahr:
    utACK 0aba464ce7
  brunoerg:
    code review ACK 0aba464ce7
  sedited:
    ACK 0aba464ce7

Tree-SHA512: b09ba4b5d13a2c93a4a28a5c1b06af44a91295974236bb8326b74a988878c431e9ce0e19ec14bb98ac2b002da877abaa7da6a9851424453bcb494c0317b57227
2026-01-21 23:09:30 +01:00
merge-script
2a1234001c Merge bitcoin/bitcoin#34269: wallet: disallow creating new or restoring to an unnamed (default) wallet
75b704df9d wallettool: Disallow creating new unnamed wallets (Ava Chow)
5875a9c502 wallet: disallow unnamed wallets in createwallet and restorewallet (Ava Chow)
d30ad4a912 wallet, rpc: Use HandleWalletError in createwallet (Ava Chow)

Pull request description:

  We've been moving in the direction that all wallets must have a name. Therefore, we shouldn't allow creating new unnamed wallets. `createwallet`, `restorewallet`, and the wallet tool's `create` and `createfromdump` all now require the user to provide a non-empty wallet name when creating/restoring a wallet.

  The GUI is already enforcing this, but we were not enforcing it for RPCs or in the underlying `CreateWallet` and `RestoreWallet` functions.

  Wallet migration does still need to be able to restore unnamed wallets, so there is a new argument to `RestoreWallet` to explicitly allow that behavior for migration only.

ACKs for top commit:
  rkrux:
    lgtm ACK 75b704df9d
  polespinasa:
    re ACK 75b704df9d

Tree-SHA512: 8bde76d0b091e9276788c69412934af3426da2a7a69a00f94072d36c1a075cd41744ecdd5fef2b72870c1351b76aae061f124f716bb23f4839be20c464fc5ebd
2026-01-21 22:56:59 +01:00
node
2845f10a2b test: extend FreeBSD ephemeral port range fix to P2P listeners
The previous commit added set_ephemeral_port_range() to
avoid port conflicts on FreeBSD by requesting ports from the high
ephemeral range (49152-65535) instead of the default range
which overlaps with the test framework's static port range.

That fix was applied to the SOCKS5 server but not to P2P listeners
created via NetworkThread.create_listen_server(). This commit extends
the fix to cover P2P listeners as well.

When port=0 is requested (dynamic allocation), we now:
1. Manually create a socket with the appropriate address family
2. Call set_ephemeral_port_range() to configure the port range
3. Bind and listen on the socket
4. Pass the pre-configured socket to asyncio's create_server()

This ensures that dynamically allocated ports for P2P listeners also
come from the high range on FreeBSD, avoiding conflicts with the test
framework's static port assignments.

Co-Authored-By: Vasil Dimov <vd@FreeBSD.org>
2026-01-21 11:33:24 -08:00
MarcoFalke
fab055c907 test: Scale NetworkThread close timeout with timeout_factor 2026-01-21 16:18:07 +01:00
rkrux
0aba464ce7 test: switch order of error code and message check
I feel it'd be easier to debug intermittent test failures if the
error message is present in the logs instead of error code. So,
switching order of error code and message in the `try_rpc` function
to aid error debugging.
2026-01-21 17:23:30 +05:30