7773 Commits

Author SHA1 Message Date
naiyoma
3f5211cba8 test: remove child_one/child_two (w)txid variables 2026-01-21 14:08:10 +03:00
naiyoma
7cfe790820 test: replace ValidWitnessMalleatedTx class with function
Simplify the witness malleation test helper by converting the
ValidWitnessMalleatedTx class to a standalone function
build_malleated_tx_package() and updating call sites.

Co-authored-by: rkrux <rkrux.connect@gmail.com>
2026-01-21 14:07:59 +03:00
naiyoma
81675a781f test: use pre-generated chain 2026-01-20 12:08:51 +03:00
Ava Chow
ae3b5a99f8
Merge bitcoin/bitcoin#34186: test: use dynamic port allocation in proxy tests
ce63d37ebee8d062310a778c5efa6475814188e9 test: use dynamic port allocation to avoid test conflicts (woltx)

Pull request description:

  Use `port=0` for dynamic port allocation in test framework components to avoid intermittent "address already in use" errors when running tests concurrently or when ports are stuck in TIME_WAIT state. Example: https://github.com/bitcoin/bitcoin/pull/29415#discussion_r2634509304

  Changes:

    - Update `socks5.py` and `p2p.py` to support dynamic port allocation
    - Convert `feature_proxy.py` and `feature_anchors.py` to use `port=0`

ACKs for top commit:
  achow101:
    ACK ce63d37ebee8d062310a778c5efa6475814188e9
  vasild:
    ACK ce63d37ebee8d062310a778c5efa6475814188e9
  mzumsande:
    re-ACK ce63d37ebee8d062310a778c5efa6475814188e9

Tree-SHA512: 4efcedca3bde209fbd1bdc2a4ae04b7d53515587d86e421ce61064f78c675c71b45d9782b514c5e7cfc0e92842c947d49f7a3fddb03fe619fcdec9b565f0ecbd
2026-01-14 14:40:10 -08:00
Ava Chow
f4364cedb3
Merge bitcoin/bitcoin#33728: test: Add bitcoin-chainstate test for assumeutxo functionality
7b5d256af4a0f954a919604ed4346db3a814fb6d test: Add bitcoin-chainstate test for assumeutxo functionality (stringintech)
2bc32656498517fe58bd41dcbd0afd306d51d4b0 Fix `ChainstateManager::AddChainstate()` assertion crash (stringintech)
5f3d6bdb6659dba16941e6d6a05fd883d3f49a9d Add regtest support to bitcoin-chainstate tool (stringintech)

Pull request description:

  This PR adds functional test coverage for the bitcoin-chainstate tool loading a datadir initialized with an assumeutxo snapshot.

  The PR also includes:
  - Fix for assertion crash in `ChainstateManager::AddChainstate()` when `prev_chainstate` has no initialized mempool (required for the test to pass)
  - `-regtest` flag support for bitcoin-chainstate to enable the testing

  This work started while experimenting with the bitcoin-chainstate tool and how the kernel API (#30595) behaved when loading a datadir containing assumeutxo data, during the time that PR was still under review. sedited suggested opening a PR to add this test coverage.

ACKs for top commit:
  achow101:
    ACK 7b5d256af4a0f954a919604ed4346db3a814fb6d
  theStack:
    Concept and code-review ACK 7b5d256af4a0f954a919604ed4346db3a814fb6d
  sedited:
    Re-ACK 7b5d256af4a0f954a919604ed4346db3a814fb6d

Tree-SHA512: 5d3b0050cf2d53144b5f65451c991d5e212117b4541ae1368ecf58fde5f3cca4f018aad6ae32257b9ebb1c28b926424fbcff496ba5487cdc4eb456cea6db8b24
2026-01-14 14:30:47 -08:00
Ava Chow
80c4c2df3f
Merge bitcoin/bitcoin#34146: p2p: send first addr self-announcement in separate message 🎄
792e2edf57ab31ae5c6f98acf33af8f67506630f p2p: first addr self-announcement in separate msg (0xb10c)

Pull request description:

  This makes sure the initial address self-announcement a node sends to a peer happends in a separate P2P message. This has benefits for both inbound and outbound connections:

  For inbound connections from a peer to us, previously, we might send the self-announcement along with our response to a GETADDR request. However, the self-announcement might replace an address from the GETADDR response. This isn't clean.

  For outbound connections from us to a peer, previously, it could have happend that we send the self-announcement along with other addresses. Since shortly after connection open, the peer might only have one rate-limiting token for us, and the addresses are shuffeld on arrival, it's possible that the self-announcement gets rate-limited. However, note that these rate-limitings seem to be rare in practice.

  This is inspired by and based on https://github.com/bitcoin/bitcoin/pull/33699#issuecomment-3462287763. The discussion there should be helpful for reviewers.

ACKs for top commit:
  bensig:
    ACK 792e2edf57ab31ae5c6f98acf33af8f67506630f
  achow101:
    ACK 792e2edf57ab31ae5c6f98acf33af8f67506630f
  fjahr:
    Code review ACK 792e2edf57ab31ae5c6f98acf33af8f67506630f
  frankomosh:
    Code Review ACK [792e2ed](792e2edf57)

Tree-SHA512: e3d39b1e3ae6208b54df4b36c624a32d70a442e01681f49e0c8a65076a818b5bf203c2e51011dc32edbbe3637b3c0b5f18de26e3461c288aa3806646a209a260
2026-01-14 14:16:33 -08:00
Ava Chow
cd0959ce9b
Merge bitcoin/bitcoin#34185: test: fix feature_pruning when built without wallet
8fb5e5f41ddf550a78b1253184d79a107097815a test: check wallet rescan properly in feature_pruning (brunoerg)
9b57c8d2bd15a414e08a9e43367d8d3d82c25fe4 test: fix feature_pruning when built without wallet (brunoerg)

Pull request description:

  Fixes #34175

  In `feature_pruning`, the`wallet_test` doesn't require any specific wallet functionality and this test is important for one of next ones (`test_scanblocks_pruned`). The reason is that it synchronizes the node 5 and, without this sync, `test_scanblocks_pruned` will fail since we expect `scanblocks` to fail due to `Block not available (pruned data)` and it doesn't happen without this sync.

ACKs for top commit:
  achow101:
    ACK 8fb5e5f41ddf550a78b1253184d79a107097815a
  furszy:
    utACK 8fb5e5f41ddf550a78b1253184d79a107097815a
  musaHaruna:
    Tested ACK [8fb5e5f](8fb5e5f41d)
  w0xlt:
    ACK 8fb5e5f41d

Tree-SHA512: 812afbf4343a7493e2169eb6735fce25692d5cb19972abafc772b8c05a64b9c7027f6675cd084f345977e916e62a722d671f90831bbdc51683e0cd253fa482f0
2026-01-14 12:58:43 -08:00
MarcoFalke
fa2959e16d
test: Fail on self-check warnings in test_runner.py 2026-01-14 10:49:11 +01:00
merge-script
d20037893a
Merge bitcoin/bitcoin#34244: test: Prevent loop from running out of utxos in bip68 test
ab41492c6ba7d3d68b53bf4299642a4f848a429f test: Prevent loop from running out of utxos in bip68 test (Fabian Jahr)

Pull request description:

  This tries to fix #34205

  I stared at the test code quite a bit and initially suspected some `MiniWallet` internals to be the issue but I think that was the wrong direction and there is simply a very small chance that the loop in `test_sequence_lock_confirmed_inputs` runs out of available utxos: We are starting out with 200-250 utxos and run the loop 400 times. If a transaction is accepted it could have up to 10 inputs but it always has only one output, so the pool is depleting in this case. And it's actually even worse because the output produced is not recognized as spendable by the `MiniWallet` because it is not using the correct output script. However, only a small fraction of transactions are actually accepted, which is why this issue almost never occurs. I did some extra printing and usually we end up with >100 utxos still available by the end of the test. But there is a small chance that too many transactions are accepted and then we can run out of utxos.

  I considered two fixes: The first was a break at the beginning of the loop `if available_utxos == 0: break`, this would work fine but I went with the second option: Simply creating the output with the correct output script so that `MiniWallet` recognizes it as spendable. This minimal replentishment of available utxos ensures that at worst we should get a few 1 input, 1 ouput transactions by the end but we should never run out of available utxos. I didn't look back in history but I suspect that this is how it was intended before `MiniWallet` introduced.

  Also moves the `random` import in the same function to the top of the file.

ACKs for top commit:
  maflcko:
    lgtm ACK ab41492c6ba7d3d68b53bf4299642a4f848a429f
  bensig:
    ACK ab41492c6ba7d3d68b53bf4299642a4f848a429f
  darosior:
    ACK ab41492c6ba7d3d68b53bf4299642a4f848a429f

Tree-SHA512: d3ce56b669d011257a4a6967923f56011dbd03362576f564b29464639391851a09113f84b5ca2902911be7aa0923ccc9f402d13e6d673fd089dfe2b1f113ae4d
2026-01-13 15:29:59 -08:00
Ava Chow
c352d3c51c
Merge bitcoin/bitcoin#34168: qa: Require --exclude for each excluded test
c5825d4b7fe9ae202ea3c74798f58cd3a920821d qa: Require `--exclude` for each excluded test (Hennadii Stepanov)

Pull request description:

  This PR allows a long `--exclude ...` argument in the `test/functional/test_runner.py` invocation to be split across multiple lines, with optional per-line explanatory comments. I found this useful for the CI scripts in https://github.com/hebasto/bitcoin-core-nightly.

ACKs for top commit:
  l0rinc:
    tested ACK c5825d4b7fe9ae202ea3c74798f58cd3a920821d
  maflcko:
    review ACK c5825d4b7fe9ae202ea3c74798f58cd3a920821d 🛄
  achow101:
    ACK c5825d4b7fe9ae202ea3c74798f58cd3a920821d
  rkrux:
    ACK c5825d4b7fe9ae202ea3c74798f58cd3a920821d

Tree-SHA512: bcf42848516197978b65df8a8bc68e036a62c9afc6158274eac74a325dc01991eb063a042f940c53ea15a7feb18d4bdfc45d8c71f0ef20c76140b12e07ba3ac5
2026-01-13 14:40:43 -08:00
Ryan Ofsky
62557c9529
Merge bitcoin/bitcoin#33819: mining: getCoinbase() returns struct instead of raw tx
48f57bb35bbdbce509b8ef195de69e2a61a2511e mining: add new getCoinbaseTx() returning a struct (Sjors Provoost)
d59b4cdb5772917ee13e48552d51662160104b62 mining: rename getCoinbaseTx() to ..RawTx() (Sjors Provoost)

Pull request description:

  The first commit renames `getCoinbaseTx()` to `getCoinbaseRawTx()` to reflect that it returns a serialised transaction. This does not impact IPC clients, because they do not use the function name.

  The second commit then introduces a replacement `getCoinbase()` that provides a struct with everything clients need to construct a coinbase. This avoids clients having to parse and manipulate our dummy transaction.

  Deprecate but don't remove `getCoinbaseRawTx()`, `getCoinbaseCommitment()` and `getWitnessCommitmentIndex()`.

  After this change we can drop these deprecated methods, which in turn would allow us to clear the dummy transaction from the `getBlock()` result. But that is left for a followup to keep this PR focussed. See https://github.com/Sjors/bitcoin/pull/106 for an approach.

  Expand the `interface_ipc.py` functional test to document its usage.

  Can be tested using:
  - https://github.com/stratum-mining/sv2-tp/pull/59

ACKs for top commit:
  ryanofsky:
    Code review ACK 48f57bb35bbdbce509b8ef195de69e2a61a2511e. Just rebased and addressed comments and dropped coinbase tx "template" suffix, which is a nice change
  ismaelsadeeq:
    code review ACK 48f57bb35bbdbce509b8ef195de69e2a61a2511e
  vasild:
    ACK 48f57bb35bbdbce509b8ef195de69e2a61a2511e

Tree-SHA512: c4f1d752777fb3086a1a0b7b8b06e4205dbe2f3adb41f218855ad1dee952adccc263cf82acd3bf9300cc83c2c64cebd2b27f66a69beee32d325b9a85e3643b0d
2026-01-13 08:01:57 -05:00
Ryan Ofsky
796f18e559
Merge bitcoin/bitcoin#29415: Broadcast own transactions only via short-lived Tor or I2P connections
89372213048adf37a47427112a1ff836ee84c50e doc: add release notes for 29415 (Vasil Dimov)
582016fa5f013817db650bbba0a40d9195c18e2e test: add unit test for the private broadcast storage (Vasil Dimov)
e74d54e04896a86cad4e4b1bd9641afcc3a026c2 test: add functional test for private broadcast (Vasil Dimov)
818b780a05db126dcfe7efe12c46c84b5cfc3de6 rpc: use private broadcast from sendrawtransaction RPC if -privatebroadcast is ON (Vasil Dimov)
eab595f9cf13f7cb1d25a0db51409535cfe053b1 net_processing: retry private broadcast (Vasil Dimov)
37b79f9c39db5a4a61d360a6a29c8853bb5c7ac0 net_processing: stop private broadcast of a transaction after round-trip (Vasil Dimov)
2de53eee742da11b0e3f6fc44c39f2b5b5929da1 net_processing: handle ConnectionType::PRIVATE_BROADCAST connections (Vasil Dimov)
30a9853ad35365af8545e8e766d75cf398968480 net_processing: move a debug check in VERACK processing earlier (Vasil Dimov)
d1092e5d48ce67bd517068550c78bfcab062a554 net_processing: modernize PushNodeVersion() (Vasil Dimov)
9937a12a2fd5a0033f37f4dda5d75bfc5f15c3b6 net_processing: move the debug log about receiving VERSION earlier (Vasil Dimov)
a098f37b9e240291077a7f440e9f57e61f30e158 net_processing: reorder the code that handles the VERSION message (Vasil Dimov)
679ce3a0b8df6e8cab07965301382d2036ef2368 net_processing: store transactions for private broadcast in PeerManager (Vasil Dimov)
a3faa6f944a672faccac5dd201c8d33a638d9091 node: extend node::TxBroadcast with a 3rd option (Vasil Dimov)
95c051e21051bd469fda659fe7c495d5e264d221 net_processing: rename RelayTransaction() to better describe what it does (Vasil Dimov)
bb49d26032c57714c62a4b31ff1fdd969751683f net: implement opening PRIVATE_BROADCAST connections (Vasil Dimov)
01dad4efe2b38b7a71c96b6222147f395e0c11d9 net: introduce a new connection type for private broadcast (Vasil Dimov)
94aaa5d31b6ff1d0122319fc70e70a7e27e1a0ba init: introduce a new option to enable/disable private broadcast (Vasil Dimov)
d6ee490e0a9a81b69a4751087918303163ba8869 log: introduce a new category for private broadcast (Vasil Dimov)

Pull request description:

  _Parts of this PR are isolated in independent smaller PRs to ease review:_

  * [x] _https://github.com/bitcoin/bitcoin/pull/29420_
  * [x] _https://github.com/bitcoin/bitcoin/pull/33454_
  * [x] _https://github.com/bitcoin/bitcoin/pull/33567_
  * [x] _https://github.com/bitcoin/bitcoin/pull/33793_

  ---

  To improve privacy, broadcast locally submitted transactions (from the `sendrawtransaction` RPC) to the P2P network only via Tor or I2P short-lived connections, or to IPv4/IPv6 peers but through the Tor network.

  * Introduce a new connection type for private broadcast of transactions with the following properties:
    * started whenever there are local transactions to be sent
    * opened to Tor or I2P peers or IPv4/IPv6 via the Tor proxy
    * opened regardless of max connections limits
    * after handshake is completed one local transaction is pushed to the peer, `PING` is sent and after receiving `PONG` the connection is closed
    * ignore all incoming messages after handshake is completed (except `PONG`)

  * Broadcast transactions submitted via `sendrawtransaction` using this new mechanism, to a few peers. Keep doing this until we receive back this transaction from one of our ordinary peers (this takes about 1 second on mainnet).

  * The transaction is stored in peerman and does not enter the mempool.

  * Once we get an `INV` from one of our ordinary peers, then the normal flow executes: we request the transaction with `GETDATA`, receive it with a `TX` message, put it in our mempool and broadcast it to all our existent connections (as if we see it for the first time).

  * After we receive the full transaction as a `TX` message, in reply to our `GETDATA` request, only then consider the transaction has propagated through the network and remove it from the storage in peerman, ending the private broadcast attempts.

  The messages exchange should look like this:

  ```
  tx-sender >--- connect -------> tx-recipient
  tx-sender >--- VERSION -------> tx-recipient (dummy VERSION with no revealing data)
  tx-sender <--- VERSION -------< tx-recipient
  tx-sender <--- WTXIDRELAY ----< tx-recipient (maybe)
  tx-sender <--- SENDADDRV2 ----< tx-recipient (maybe)
  tx-sender <--- SENDTXRCNCL ---< tx-recipient (maybe)
  tx-sender <--- VERACK --------< tx-recipient
  tx-sender >--- VERACK --------> tx-recipient
  tx-sender >--- INV/TX --------> tx-recipient
  tx-sender <--- GETDATA/TX ----< tx-recipient
  tx-sender >--- TX ------------> tx-recipient
  tx-sender >--- PING ----------> tx-recipient
  tx-sender <--- PONG ----------< tx-recipient
  tx-sender disconnects
  ```

  Whenever a new transaction is received from `sendrawtransaction` RPC, the node will send it to a few (`NUM_PRIVATE_BROADCAST_PER_TX`) recipients right away. If after some time we still have not heard anything about the transaction from the network, then it will be sent to 1 more peer (see `PeerManagerImpl::ReattemptPrivateBroadcast()`).

  A few considerations:
  * The short-lived private broadcast connections are very cheap and fast wrt network traffic. It is expected that some of those peers could blackhole the transaction. Just one honest/proper peer is enough for successful propagation.
  * The peers that receive the transaction could deduce that this is initial transaction broadcast from the transaction originator. This is ok, they can't identify the sender.

  ---

  <details>
  <summary>How to test this?</summary>

  Thank you, @stratospher and @andrewtoth!

  Start `bitcoind` with `-privatebroadcast=1 -debug=privatebroadcast`.

  Create a wallet and get a new address, go to the Signet faucet and request some coins to that address:
  ```bash
  build/bin/bitcoin-cli -chain="signet" createwallet test
  build/bin/bitcoin-cli -chain="signet" getnewaddress
  ```

  Get a new address for the test transaction recipient:
  ```bash
  build/bin/bitcoin-cli -chain="signet" loadwallet test
  new_address=$(build/bin/bitcoin-cli -chain="signet" getnewaddress)
  ```

  Create the transaction:
  ```bash
  # Option 1: `createrawtransaction` and `signrawtransactionwithwallet`:

  txid=$(build/bin/bitcoin-cli -chain="signet" listunspent | jq -r '.[0] | .txid')
  vout=$(build/bin/bitcoin-cli -chain="signet" listunspent | jq -r '.[0] | .vout')
  echo "txid: $txid"
  echo "vout: $vout"

  tx=$(build/bin/bitcoin-cli -chain="signet" createrawtransaction "[{\"txid\": \"$txid\", \"vout\": $vout}]" "[{\"$new_address\": 0.00001000}]" 0 false)
  echo "tx: $tx"

  signed_tx=$(build/bin/bitcoin-cli -chain="signet" signrawtransactionwithwallet "$tx" | jq -r '.hex')
  echo "signed_tx: $signed_tx"

  # OR Option 2: `walletcreatefundedpsbt` and `walletprocesspsbt`:
  # This makes it not have to worry about inputs and also automatically sends back change to the wallet.
  # Start `bitcoind` with `-fallbackfee=0.00003000` for instance for 3 sat/vbyte fee.

  psbt=$(build/bin/bitcoin-cli -chain="signet" walletcreatefundedpsbt "[]" "[{\"$new_address\": 0.00001000}]" | jq -r '.psbt')
  echo "psbt: $psbt"

  signed_tx=$(build/bin/bitcoin-cli -chain="signet" walletprocesspsbt "$psbt" | jq -r '.hex')
  echo "signed_tx: $signed_tx"
  ```

  Finally, send the transaction:
  ```bash
  raw_tx=$(build/bin/bitcoin-cli -chain="signet" sendrawtransaction "$signed_tx")
  echo "raw_tx: $raw_tx"
  ```

  </details>

  ---

  <details>
  <summary>High-level explanation of the commits</summary>

  * New logging category and config option to enable private broadcast
    * `log: introduce a new category for private broadcast`
    * `init: introduce a new option to enable/disable private broadcast`

  * Implement the private broadcast connection handling on the `CConnman` side:
    * `net: introduce a new connection type for private broadcast`
    * `net: implement opening PRIVATE_BROADCAST connections`

  * Prepare `BroadcastTransaction()` for private broadcast requests:
    * `net_processing: rename RelayTransaction to better describe what it does`
    * `node: extend node::TxBroadcast with a 3rd option`
    * `net_processing: store transactions for private broadcast in PeerManager`

  * Implement the private broadcast connection handling on the `PeerManager` side:
    * `net_processing: reorder the code that handles the VERSION message`
    * `net_processing: move the debug log about receiving VERSION earlier`
    * `net_processing: modernize PushNodeVersion()`
    * `net_processing: move a debug check in VERACK processing earlier`
    * `net_processing: handle ConnectionType::PRIVATE_BROADCAST connections`
    * `net_processing: stop private broadcast of a transaction after round-trip`
    * `net_processing: retry private broadcast`

  * Engage the new functionality from `sendrawtransaction`:
    * `rpc: use private broadcast from sendrawtransaction RPC if -privatebroadcast is ON`

  * New tests:
    * `test: add functional test for private broadcast`
    * `test: add unit test for the private broadcast storage`

  </details>

  ---

  **This PR would resolve the following issues:**
  https://github.com/bitcoin/bitcoin/issues/3828 Clients leak IPs if they are recipients of a transaction
  https://github.com/bitcoin/bitcoin/issues/14692 Can't configure bitocoind to only send tx via Tor but receive clearnet transactions
  https://github.com/bitcoin/bitcoin/issues/19042 Tor-only transaction broadcast onlynet=onion alternative
  https://github.com/bitcoin/bitcoin/issues/24557 Option for receive events with all networks, but send transactions and/or blocks only with anonymous network[s]?
  https://github.com/bitcoin/bitcoin/issues/25450 Ability to broadcast wallet transactions only via dedicated oneshot Tor connections
  https://github.com/bitcoin/bitcoin/issues/32235 Tor: TX circuit isolation

  **Issues that are related, but (maybe?) not to be resolved by this PR:**
  https://github.com/bitcoin/bitcoin/issues/21876 Broadcast a transaction to specific nodes
  https://github.com/bitcoin/bitcoin/issues/28636 new RPC: sendrawtransactiontopeer

  ---

  Further extensions:
  * Have the wallet do the private broadcast as well, https://github.com/bitcoin/bitcoin/issues/11887 would have to be resolved.
  * Have the `submitpackage` RPC do the private broadcast as well, [draft diff in the comment below](https://github.com/bitcoin/bitcoin/pull/29415#pullrequestreview-2972293733), thanks ismaelsadeeq!
  * Add some stats via RPC, so that the user can better monitor what is going on during and after the broadcast. Currently this can be done via the debug log, but that is not convenient.
  * Make the private broadcast storage, currently in peerman, persistent over node restarts.
  * Add (optional) random delay before starting to broadcast the transaction in order to avoid correlating unrelated transactions based on the time when they were broadcast. Suggested independently of this PR [here](https://github.com/bitcoin/bitcoin/issues/30471).
  * Consider periodically sending transactions that did not originate from the node as decoy, discussed [here](https://github.com/bitcoin/bitcoin/pull/29415#discussion_r2035414972).
  * Consider waiting for peer's FEEFILTER message and if the transaction that was sent to the peer is below that threshold, then assume the peer is going to drop it. Then use this knowledge to retry more aggressively with another peer, instead of the current 10 min. See [comment below](https://github.com/bitcoin/bitcoin/pull/29415#issuecomment-3258611648).
  * It may make sense to be able to override the default policy -- eg so submitrawtransaction can go straight to the mempool and relay, even if txs are normally privately relayed. See [comment below](https://github.com/bitcoin/bitcoin/pull/29415#issuecomment-3427086681).
  * As a side effect we have a new metric available - the time it takes for a transaction to reach a random node in the network (from the point of view of the private broadcast recipient the tx originator is a random node somewhere in the network). This can be useful for monitoring, unrelated to privacy characteristics of this feature.

  ---

  _A previous incarnation of this can be found at https://github.com/bitcoin/bitcoin/pull/27509. It puts the transaction in the mempool and (tries to) hide it from the outside observers. This turned out to be too error prone or maybe even impossible._

ACKs for top commit:
  l0rinc:
    code review diff ACK 89372213048adf37a47427112a1ff836ee84c50e
  andrewtoth:
    ACK 89372213048adf37a47427112a1ff836ee84c50e
  pinheadmz:
    ACK 89372213048adf37a47427112a1ff836ee84c50e
  w0xlt:
    ACK 8937221304 with nit https://github.com/bitcoin/bitcoin/pull/29415#discussion_r2654849875
  mzumsande:
    re-ACK 89372213048adf37a47427112a1ff836ee84c50e

Tree-SHA512: d51dadc865c2eb080c903cbe2f669e69a967e5f9fc64e9a20a68f39a67bf0db6ac2ad682af7fa24ef9f0942a41c89959341a16ba7b616475e1c5ab8e563b9b96
2026-01-12 15:02:14 -05:00
woltx
ce63d37ebe test: use dynamic port allocation to avoid test conflicts
Use port=0 for dynamic port allocation in test framework components
to avoid "address already in use" errors from concurrent tests or
ports stuck in TIME_WAIT state from previous test runs.

Changes:
- socks5.py: Update conf.addr after bind() to reflect actual port
- p2p.py: Retrieve actual port after create_server() when port=0
- feature_proxy.py: Use port=0 for all SOCKS5 proxy servers
- feature_anchors.py: Use port=0 for onion proxy server
2026-01-09 18:43:44 -08:00
Fabian Jahr
ab41492c6b
test: Prevent loop from running out of utxos in bip68 test 2026-01-09 23:57:35 +01:00
brunoerg
8fb5e5f41d test: check wallet rescan properly in feature_pruning 2026-01-09 09:27:19 -03:00
David Gumberg
eeaf28dbe0 wallet: test: Failed migration cleanup
Refactor a common way to perform the failed migration test that exists
for default wallets, and add relative-path wallets and absolute-path
wallets.
2026-01-08 14:00:46 -08:00
furszy
cbf0bd35bb
test: migration, avoid backup name mismatch in default_wallet_failure
The test calls migrate_and_get_rpc(), which sets mock time internally.
The caller caches a mock time value and later relies on it to predict the
backup filename, so setting the mock time again could cause a naming
mismatch.

Fix this by calling the migration RPC directly. Since the test expects the
migration to fail, migrate_and_get_rpc() is unnecessary here.
2026-01-07 16:33:00 -05:00
merge-script
cd6e4c9235
Merge bitcoin/bitcoin#34215: wallettool: fix unnamed createfromdump failure walletsdir deletion
f78f6f1dc8e16d5a8a23749e77bc3bf17c91ae42 wallettool: do not use fs::remove_all in createfromdump cleanup (Ava Chow)

Pull request description:

  As pointed out in https://github.com/bitcoin/bitcoin/pull/34156#issuecomment-3716728670, it is possible for `createfromdump` to also accidentally delete the entire wallets directory if the wallet name is the empty string and the dumpfile contains a checksum error.

  This is also fixed by removing the files created by only removing the directory for named wallets, and avoiding the use of `fs::remove_all`.

ACKs for top commit:
  waketraindev:
    lgtm ACK f78f6f1dc8e16d5a8a23749e77bc3bf17c91ae42
  polespinasa:
    code review and tACK f78f6f1dc8e16d5a8a23749e77bc3bf17c91ae42
  rkrux:
    Code review and tACK f78f6f1dc8e16d5a8a23749e77bc3bf17c91ae42
  willcl-ark:
    ACK f78f6f1dc8e16d5a8a23749e77bc3bf17c91ae42
  pablomartin4btc:
    ACK f78f6f1dc8e16d5a8a23749e77bc3bf17c91ae42

Tree-SHA512: ff1e7668131ec3632c67d990c99e8fddff28605e7e553c7e20695e61017c88476c3636e22f2007e763a00d527e80e4d1d3d45409f6678d28729b8397430bfe7a
2026-01-07 14:32:01 +00:00
merge-script
90d651a81f
Merge bitcoin/bitcoin#34156: wallet: fix unnamed legacy wallet migration failure
b7c34d08dd9549a95cffc6ec1ffa4bb4f81e35eb test: coverage for migration failure when last sync is beyond prune height (furszy)
82caa8193a3e36f248dcc949e0cd41def191efac wallet: migration, fix watch-only and solvables wallets names (furszy)
d70b159c42008ac3b63d1c43d99d4f1316d2f1ef wallet: improve post-migration logging (furszy)
f011e0f0680a8c39988ae57dae57eb86e92dd449 test: restorewallet, coverage for existing dirs, unnamed wallet and prune failure (furszy)
36093bde63286e19821a9e62cdff1712b6245dc7 test: add coverage for unnamed wallet migration failure (furszy)
f4c7e28e80bf9af50b03a770b641fd309a801589 wallet: fix unnamed wallet migration failure (furszy)
4ed0693a3f2a427ef9e7ad016930ec29fa244995 wallet: RestoreWallet failure, erase only what was created (furszy)

Pull request description:

  Minimal fix for #34128.

  The issue occurs during the migration of a legacy unnamed wallet
  (the legacy "default" wallet). When the migration fails, the cleanup
  logic is triggered to roll back the state, which involves erasing the
  newly created descriptor wallets directories. Normally, this only
  affects the parent directories of named wallets, since they each
  reside in their own directories. However, because the unnamed
  wallet resides directly in the top-level `/wallets/` folder, this
  logic accidentally deletes the main directory.

  The fix ensures that only the wallet.dat file of the unnamed wallet
  is touched and restored, preserving the wallet in BDB format and
  leaving the main `/wallets/` directory intact.

  #### Story Line:
  #32273 fixed a different set of issues and, in doing so, uncovered
  this one.
  Before the mentioned PR, backups were stored in the same directory
  as the wallet.dat file. On a migration failure, the backup was then
  copied to the top-level `/wallets/` directory. For the unnamed legacy
  wallet, the wallet directory is the `/wallets/` directory, so the source
  and destination paths were identical. As a result, we threw early in the
  `fs::copy_file` call ([here](https://github.com/bitcoin/bitcoin/blob/29.x/src/wallet/wallet.cpp#L4572)) because the file already existed, as we
  were trying to copy the file onto itself. This caused the cleanup logic
  to abort early on and never reach the removal line.

  #### Testing Notes:
  Cherry-pick the test commit on top of master and run it. You will
  see the failure and realize the reason by reading the test code.

ACKs for top commit:
  achow101:
    ACK b7c34d08dd9549a95cffc6ec1ffa4bb4f81e35eb
  davidgumberg:
    crACK b7c34d08dd
  w0xlt:
    ACK b7c34d08dd
  willcl-ark:
    ACK b7c34d08dd9549a95cffc6ec1ffa4bb4f81e35eb

Tree-SHA512: d0be14c0ed6417f999c3f2f429652c2407097d0cc18453c91653e57ae4b5375b327ad3b2553d9ea6ff46a3ae00cdbd5ab325b94eba763072c4fc5a773b85618b
2026-01-07 11:08:57 +00:00
Ava Chow
f78f6f1dc8 wallettool: do not use fs::remove_all in createfromdump cleanup 2026-01-06 16:11:41 -08:00
furszy
b7c34d08dd
test: coverage for migration failure when last sync is beyond prune height 2026-01-06 14:38:14 -05:00
furszy
82caa8193a
wallet: migration, fix watch-only and solvables wallets names
Because the default wallet has no name, the watch-only and solvables
wallets created during migration end up having no name either.

This fixes it by applying the same prefix name we use for the backup
file for an unnamed default wallet.

Before: watch-only wallet named "_watchonly"
After:  watch-only wallet named "default_wallet_watchonly"
2026-01-06 14:38:14 -05:00
furszy
f011e0f068
test: restorewallet, coverage for existing dirs, unnamed wallet and prune failure
The first test verifies that restoring into an existing empty directory
or a directory with no .dat db files succeeds, while restoring into a
dir with a .dat file fails.

The second test covers restoring into the default unnamed wallet
(wallet.dat), which also implicitly exercises the recovery path used
after a failed migration.

The third test covers failure during restore on a prune node. When
the wallet last sync was beyond the pruning height.
2026-01-06 14:38:13 -05:00
furszy
36093bde63
test: add coverage for unnamed wallet migration failure
Verifies that a failed migration of the unnamed (default) wallet
does not erase the main /wallets/ directory, and also that the
backup file exists.
2026-01-06 14:38:13 -05:00
furszy
f4c7e28e80
wallet: fix unnamed wallet migration failure
When migrating any legacy unnamed wallet, a failed migration would
cause the cleanup logic to remove its parent directory. Since this
type of legacy wallet lives directly in the main '/wallets/' folder,
this resulted in unintentionally erasing all wallets, including the
backup file.

To be fully safe, we will no longer call `fs::remove_all`. Instead,
we only erase the individual db files we have created, leaving
everything else intact. The created wallets parent directories are
erased only if they are empty.
As part of this last change, `RestoreWallet` was modified to allow
an existing directory as the destination, since we no longer remove
the original wallet directory (we only remove the files we created
inside it). This also fixes the restore of top-level default wallets
during failures, which were failing due to the directory existence
check that always returns true for the /wallets/ directory.

This bug started after:
f6ee59b6e2
Previously, the `fs::copy_file` call was failing for top-level wallets,
which prevented the `fs::remove_all` call from being reached.
2026-01-06 14:38:13 -05:00
merge-script
d7cbdfa090
Merge bitcoin/bitcoin#34204: test: fix intermittent failure in p2p_addr_selfannouncement
31852057ea393e64b7ea2bfabc75a55fda40b786 test: fix intermittent failure in p2p_addr_selfannouncement (0xb10c)

Pull request description:

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

  closes #34159

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

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

Pull request description:

  The ctest target `bench_sanity_check` has many issues:

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

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

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

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

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

Pull request description:

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

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

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

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

Pull request description:

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

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

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

Tree-SHA512: 4741db96b278e9f3d532e1873af9530a70bbc7a8d3625b9e1c07001acc472fc10cbb79995c16bc4d06cc568ef98fe8d2b8e8d87b617dc05d7554085ffb92dfef
2026-01-05 14:56:25 -08:00
merge-script
755f0900a2
Merge bitcoin/bitcoin#34136: test: Allow mempool_updatefromblock.py to run on 32-bit
fac5a1b10a6979a7898c5c3555d62b593560772f test: Allow mempool_updatefromblock.py to run on 32-bit (MarcoFalke)

Pull request description:

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

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

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

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

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

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

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

Tree-SHA512: 8d468f306d95e52cbfac1803293e3b8e9575c9010200010c7833382112509e0d51827dc9681b0b68eeae742af2c14d12da5fd4cf0e1d871a02f91fc80e6720d1
2026-01-05 14:51:24 +00:00
rkrux
5805a8b540
psbt: detect invalid MuSig2 pubkeys in deserialization
Throw error while deserializing PSBT if invalid pubkeys are passed
as a MuSig2 aggregate or participant.
2026-01-05 16:24:26 +05:30
0xb10c
792e2edf57
p2p: first addr self-announcement in separate msg
This makes sure the initial address self-announcement a node sends to
a peer happends in a separate P2P message. This has benefits for both
inbound and outbound connections:

For inbound connections from a peer to us, previously, we might send
the self-announcement along with our response to a GETADDR request.
However, the self-announcement might replace an address from the
GETADDR response. This isn't clean.

For outbound connections from us to a peer, previously, it could have
happend that we send the self-announcement along with other addresses.
Since shortly after connection open, the peer might only have one
rate-limiting token for us, and the addresses are shuffeld on arrival,
it's possible that the self-announcement gets rate-limited. However,
note that these rate-limitings seem to be rare in practice.

This is inspired by and based on https://github.com/bitcoin/bitcoin/pull/33699#issuecomment-3462287763

Co-Authored-By: Anthony Towns <aj@erisian.com.au>
2026-01-05 11:39:26 +01:00
0xb10c
31852057ea
test: fix intermittent failure in p2p_addr_selfannouncement
Due to the mocktime being bumped before the expected time is updated,
it could happen that the self-announcement is send with an newer
timestamp than what we expect. To fix this, update the expected time
before we bump the mocktime.

closes #34159
2026-01-05 10:28:32 +01:00
Sjors Provoost
48f57bb35b
mining: add new getCoinbaseTx() returning a struct
Introduce a new method intended to replace getCoinbaseRawTx(), which
provides a struct with everything clients need to construct a coinbase.
This is safer than providing a raw dummy coinbase that clients then have
to manipulate.

The CoinbaseTx data is populated during the dummy transaction generation
and stored in struct CBlockTemplate.

Expand the interface_ipc.py functional test to document its usage
and ensure equivalence.
2026-01-05 09:51:57 +07:00
merge-script
bd4f4782f2
Merge bitcoin/bitcoin#34154: test: Enable ruff E713 lint
fab300b378941a233119805c0d62198596a57790 test: Enable ruff E713 lint (MarcoFalke)

Pull request description:

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

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

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

Tree-SHA512: c3eaf0fbe0dd22d8e04b896e98adaf28162fb748e6f7f5ebfd73b2020da66046bf8f0c1a27db5da05250366b98ded8c4a55d53edd8fa050e80521aee42ba3c5a
2026-01-04 16:22:38 +00:00
Sebastian Falbesoner
4ce3f4a265 rpc, net: deprecate startingheight field of getpeerinfo RPC
The reported starting height of a peer in the VERSION message is
untrusted, and it doesn't seem to be useful anymore (after #20624),
so deprecating the corresponding "startingheight" field seems
reasonable. After that, it can be removed, along with the
`m_starting_height` field of the Peer / CNodeStats structs, as it is
sufficient to show the reported height only once at connection in the
debug log.
2026-01-04 02:02:01 +01:00
Ava Chow
2628de7479
Merge bitcoin/bitcoin#33135: wallet: warn against accidental unsafe older() import
76c092ff805833a9adf84f669f0455bc2e0bba8b wallet: warn against accidental unsafe older() import (Sjors Provoost)
592157b7594693da389e4bd9b2cdedbdba7556fc test: move SEQUENCE_LOCKTIME flags to script (Sjors Provoost)

Pull request description:

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

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

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

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

  It adds both a unit and functional test.

  ---

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

  ---

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

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

Tree-SHA512: 8e944e499bd4a43cc27eeb889f262b499b9b07aa07610f4a415ccb4e34a9110f9946646f446a54ac5bf17494d8d96a89e4a1fa278385db9b950468f27283e17a
2026-01-02 16:15:50 -08:00
brunoerg
9b57c8d2bd test: fix feature_pruning when built without wallet 2026-01-02 18:50:35 -03:00
Hennadii Stepanov
c5825d4b7f
qa: Require --exclude for each excluded test
Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
2026-01-02 13:24:56 +00:00
merge-script
6ed2cf5184
Merge bitcoin/bitcoin#34169: fuzz: change fuzz runner test_runner.py to be cwd independent
77c9b3c08f5f195c9afe8fba2395fbe48068fce0 change test_runner.py to be cwd independent by calling subprocess.run with cwd arg. (Robin David)

Pull request description:

  Dear Maintainers,

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

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

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

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

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

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

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

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

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

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

Tree-SHA512: fbc821c4790dd9ac125046a842498e0d9a48549d1c8ef150bce2193ee62bee9c3bfd4b17ce278411102dd200dc9ad86a176ecae29ca1667bb14d6f90ad67e01d
2026-01-02 11:03:04 +00:00
MarcoFalke
fa65bc0e79
test: Run bench sanity checks in parallel with functional tests 2026-01-01 20:44:09 +01:00
MarcoFalke
fa9fdbce79
test: Pass bench exe into test framework utils
This teaches the test framework about the bench executable, which is
required for the next commit.
2026-01-01 20:38:59 +01:00
merge-script
891aed2f75
Merge bitcoin/bitcoin#34172: Fix intermittent issue in p2p_1p1c_network.py
95ef0fc5e78146e367e9454ba6b2899503631858 test: ensure clean orphanage before continuing (Greg Sanders)
25e84d377202e4f7f2f47efc1cff6daa730f3bfa test: change low fee parents to 0-fee (Greg Sanders)

Pull request description:

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

ACKs for top commit:
  glozow:
    utACK 95ef0fc5e78146e367e9454ba6b2899503631858

Tree-SHA512: 4952062cb46b0e9f665de454718d093d3eac17532e4330caf80290f82b130614db3ccc5e5abf06f1e66237b9ba53ecdd0d13e4d5b09812f5c91db00b948ebb6b
2025-12-31 11:26:56 +00:00
Robin David
77c9b3c08f change test_runner.py to be cwd independent by calling subprocess.run with cwd arg. 2025-12-30 11:30:21 +01:00
Greg Sanders
95ef0fc5e7 test: ensure clean orphanage before continuing
The tests were written assuming transaction orphans would
persist for a time beyond the test peer's disconnection.
After #31829 this no longer holds, so as a minimal fix we
modify the test to wait until the orphans are removed before
continuing with the final transaction submissions.
2025-12-29 11:05:14 -05:00
Greg Sanders
25e84d3772 test: change low fee parents to 0-fee
The test is harder to read, and had an explicit 1sat/vbyte
floor assumption in a single place which is incorrect. Using
0-fee makes the test more future proof.
2025-12-29 11:05:14 -05:00
merge-script
2bcb3f6464
Merge bitcoin/bitcoin#34112: rpc: [mempool] Remove erroneous Univalue integral casts
fab1f4b800d007bd4756b2519c64e1506ffe0d6c rpc: [mempool] Remove erroneous Univalue integral casts (MarcoFalke)

Pull request description:

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

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

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

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

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

Tree-SHA512: b03c888ec07a8bdff25f7ded67f253b2a8edd83adf08980416e2ac8ac1b36ad952cc5828be833d19f64a55abab62d7a1c6f181bc5f1388ed08cc178b4aaec6ee
2025-12-29 07:16:39 -08:00
merge-script
ec4ff99a22
Merge bitcoin/bitcoin#33892: policy: allow <minrelay txns in package context if paid for by cpfp
e44dec027ceec2a5f74b65636689a51833d78a94 add release note about supporing non-TRUC <minrelay txns (Greg Sanders)
1488315d76ee40b9d021b7d0ecd01207eee4a426 policy: Allow any transaction version with < minrelay (Greg Sanders)

Pull request description:

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

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

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

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

Pull request description:

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

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

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

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

Tree-SHA512: 7b59496a1b9b8044548423ad517ff03e98521685cf65499cd0ef499d6fd3d72ad374c92ca815436675ed6ae7be508a5a1afce699b804a384d7aee6a195d8d972
2025-12-27 16:07:16 +00:00
MarcoFalke
fab300b378
test: Enable ruff E713 lint 2025-12-26 08:19:34 +01:00